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)

I also encountered this issue while trying to use fullCalendar in my app. You have to upgrade to version .7x and newer and add [DONTWRAPRESULT] in your controller action. I wish these transformations would be off by default.

Answer

Adding hte Virtual directive worked! And now the tenantid is getting filtered correctly.

Thanks!

Answer

Thanks! I'll try the virtual on the method.

Answer

Yes..I did implement the IMusthaveTenant Attributes. As you can see from my example, the filter works for simple queries against one table but not for multiple tables.

I was able to get around it by creating an application service and disabling the filter thru the CurrentUnitOfWork interface.

I do have another question as to how to access the CurrentUnitOfWork within my controllers? I've added the attribute to my method and did the correct injection for _unitofworkmanager...but _unitofworkmanager.current always comes up as null.

Thanks!

I'm also interested in more details on how to implement this. I've looked at the sample project but do not see how users or roles can be given rights to specific permissions settings.

Thanks!

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 7 of 7 entries