Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "balikpinoy"

Core/Properties/AssemblyInfo.cs(12,12): Error CS0433: The type 'AssemblyTitleAttribute' exists in both 'System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' (CS0433)

Question

Hi! Thanks for this great piece of work.

I'm having some issue doing a two table query and it looks like the tenantid is not being injected correctly.

Two tables, homeowners and property joined on propertyid..I used glimpse to look at the sql being generated by EF.

Here's a simple homeowner query with the tenantid correctly filtered.

FROM [dbo].[Homeowners] AS [Var_3] WHERE (([Var_3].[TenantId] = 2 /* @DynamicFilterParam_5 /) OR (NULL / @DynamicFilterParam_6 / IS NOT NULL)) AND (([Var_3].[IsDeleted] = False / @DynamicFilterParam_1 /) OR (NULL / @DynamicFilterParam_2 */ IS NOT NULL)) Name Value Type Size @DynamicFilterParam_5 2 Int32 0 @DynamicFilterParam_6 NULL Boolean 0 @DynamicFilterParam_1 false Boolean 0

My other query

FROM [dbo].[Properties] AS [Var_4] WHERE (([Var_4].[TenantId] = 0 /* @DynamicFilterParam_5 /) OR (NULL / @DynamicFilterParam_6 / IS NOT NULL)) AND (([Var_4].[IsDeleted] = False / @DynamicFilterParam_1 /) OR (NULL / @DynamicFilterParam_2 / IS NOT NULL)) ) AS [Extent1] INNER JOIN (SELECT [Var_5].[Id] AS [Id], [Var_5].[TenantId] AS [TenantId], [Var_5].[PersonID] AS [PersonID], [Var_5].[PropertyID] AS [PropertyID], [Var_5].[StartDate] AS [StartDate], [Var_5].[OwnerType] AS [OwnerType] FROM [dbo].[Homeowners] AS [Var_5] WHERE (([Var_5].[TenantId] = 0 / @DynamicFilterParam_5 /) OR (NULL / @DynamicFilterParam_6 / IS NOT NULL)) AND (([Var_5].[IsDeleted] = False / @DynamicFilterParam_1 /) OR (NULL / @DynamicFilterParam_2 / IS NOT NULL)) ) AS [Extent2] ON [Extent1].[Id] = [Extent2].[PropertyID] WHERE ([Extent2].[PersonID] = 22 / @p__linq__0 */)

Am I doing anything wrong? Here's the original query

            var model = from p in db.Properties 
                        join h in db.Homeowners 
                            on p.Id equals h.PropertyID
                        where h.PersonID == pId  
                        select new PropertyViewModel()
                        {
                            ID = p.Id,
                            Village = p.Village,
                            HomeownerID = h.Id, ...
                        };

I also tried using repository.GetAll() instead of db but I kept getting dbContext has been disposed error.

Thanks !

Showing 1 to 2 of 2 entries