我在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.SortDescriptors>
</dds:DomainDataSource>
如何在上面的代码中插入数据库行而不提交DataForm?
答案 0 :(得分:3)
在您的代码隐藏中,您应该能够执行以下操作:
// 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();