我基于现有的数据库在我的项目中添加了一个新的 ADO.NET ORM 对象。我能够创建一个新对象,但我不太明白如何在数据库中插入我的新对象并获取从中生成的 ID。
从链接中显示的示例中,我只是不明白他们的TestDBEntities类是什么
我也愿意接受任何基于经验的 ORM 建议!谢谢!
public static void Insert_Demande_Willy(string ModelPath)
{
using (TestDBEntities ctx = new TestDBEntities())
{
Model.CreateDessin newDemande = new CreateDessin()
{
DateProduite = DateTime.Now,
GenerateBom = Willy.Properties.Settings.Default.GenerateBom.ToString(),
MailAdress = Willy.Properties.Settings.Default.Email,
NotifyRBRE = Willy.Properties.Settings.Default.Wilma_RBRE.ToString(),
NotifyRBTK = Willy.Properties.Settings.Default.Wilma_RBTK.ToString(),
NotifyTLS = Willy.Properties.Settings.Default.Wilma_TLS.ToString(),
NotifyTQ = Willy.Properties.Settings.Default.Wilma_TQ.ToString(),
PathDessin = ModelPath,
SendingComputer = Environment.MachineName,
UserName = Environment.UserName
};
Insert_Demande_Willy_DTL(newDe)
}
}
/// <summary>
/// Importer Statuts enumeration
/// Setter priorité
/// NoECO juste quand check?
/// IF DEV TESTED BY
/// </summary>
/// <param name="ID"></param>
private static void Insert_Demande_Willy_DTL(int ID)
{
Model.CreateDessinDTL newDemandeDTL = new CreateDessinDTL()
{
ConfigName = "",
CreatePDF = Willy.Properties.Settings.Default.GeneratePDF.ToString(),
C_ID = ID,
NoECO = Willy.Properties.Settings.Default.EcoName,
Priority = 2,
Statut = "Willy2",
};
}
郎朗坤
慕慕森
相关分类