开发者

How to insert a new row in DB using RIA in code behind without DataForm?

开发者 https://www.devze.com 2022-12-14 20:22 出处:网络
I have all of the data in the code below defined in XAML: <dds:DomainDataSource x:Name=\"ddsContAttachment\" QueryName=\"GetMContAttachment\" AutoLoad=\"True\" LoadSize=\"20\">

I have all of the data in the code below defined in XAML:

    <dds:DomainDataSource x:Name="ddsContAttachment" QueryName="GetMContAttachment" AutoLoad="True" LoadSize="20">
        <dds:DomainDataSource.DomainContext>
            <employee:ContractSrv />
        </dds:DomainDataSource.DomainContext>
        <dds:DomainDataSource.SortDescriptors>
            <filter:SortDescriptor PropertyPath="wContId" Direction="Ascending" />
            <filter:SortDescriptor PropertyPath="wSeqId" Direction="Ascending" />
        </dds:DomainDataSource.SortDescriptor开发者_JS百科s>
    </dds:DomainDataSource>

How do I insert a DB row without filing DataForm in the code above?


In your code-behind, you should be able to do the following:

// get a new entity
var attachment = new Attachment();

// initialize attachment properties as needed
this.ddsContAttachment.DataView.Add(attachment);

// when ready to submit the new record...
this.ddsContAttachment.SubmitChanges();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号