Set the value of the service field in dynamic data

In my project, many tables are associated with the aspnet_Application table with the ApplicationId foreign key. I don’t want users to view or edit it, so I’m looking for a way to set this sql table field value before executing the insert request. I still have forests for this column (so that DD will generate the correct sql script), but I hide this column / field on all edit / list / insert pages.

Ideally, I am looking for a place to enter my code right before DynamicInsert is executed for any table in my LinqToSql class.

thanks

+3
source share
2 answers

, . Insert_ , aspnet_Applications. ApplicationId .

:

public partial class MyDataContext
{
    partial void InsertMyTable(MyTable instance)
    {
        instance.ApplicationId = HttpContext.Current.Session["ApplicationId"] as Guid?;
    this.ExecuteDynamicInsert(instance);
    }
}

, LINQ . , , aspnet_Applications.

, ( ), , - , :)

+2

DomainService.Net RIA Services, MIX09, . :

.NET RIA Services - Microsoft Silverlight Microsoft ASP.NET

Microsoft ASP.NET 4.0: -

-, introl .net RIA Services Silverlight, , DD, - MIX , DomainService DD. , , - , DomainService.

0

Source: https://habr.com/ru/post/1705518/


All Articles