when creating POC LINQ to SQL and entities, I ran into a problem stuck in a frozen deadlock. The problem is that I use LINQ to SP, and everything works fine, and I made cool editing, adding and removing methods. Then, a thing clicks in my mine that “what if I just return two recordsets from SP”. I did SP and returned two recordsets from it
SPs look like this: [Demo]
Create PROCEDURE [dbo].GetUserData
@UserId Bigint
AS
BEGIN
SET NOCOUNT ON;
select * from [User] where id=@UserId
select * from [Role] where userId=@UserId
end
then I dropped this SP in my DBML (Linq to SQL) class and then noticed that only a single record set schema was created like this
<?xml version="1.0" encoding="utf-8"?>
<Database Name="MyInventory" Class="MyDBMLDataContext" xmlns="http://schemas.microsoft.com/linqtosql/dbml/2007">
<Connection Mode="AppSettings" ConnectionString="Data Source=MyDatabaseServer\;Initial Catalog=MyInventory;Integrated Security=True" SettingsObjectName="ConsoleApplication16.Properties.Settings" SettingsPropertyName="MyInventoryConnectionString" Provider="System.Data.SqlClient" />
<Function Name="dbo.GetUserData" Method="GetUserData">
<Parameter Name="UserId" Parameter="userId" Type="System.Int64" DbType="BigInt" />
<ElementType Name="GetUserDataResult">
<Column Name="Id" Type="System.Int64" DbType="BigInt NOT NULL" CanBeNull="false" />
<Column Name="Name" Type="System.String" DbType="VarChar(50) NOT NULL" CanBeNull="false" />
<Column Name="Email" Type="System.String" DbType="NVarChar(50)" CanBeNull="true" />
<Column Name="IsDeleted" Type="System.Boolean" DbType="Bit NOT NULL" CanBeNull="false" />
<Column Name="HomePage" Type="System.String" DbType="VarChar(100)" CanBeNull="true" />
</ElementType>
</Function>
</Database>
I clearly see that only one set of entries is created from user records, and he lacks the role scheme: (.
- , ?
Lura
Lura I