开发者

SubSonic2.2 Add() not working

开发者 https://www.devze.com 2022-12-19 10:47 出处:网络
I have 2 tables in my DB, Customers, Contacts. CusID is a Foreig开发者_JS百科n Key in Contacts table. I tried the following

I have 2 tables in my DB, Customers, Contacts. CusID is a Foreig开发者_JS百科n Key in Contacts table. I tried the following

Dim contact as New Contact(Guid.NewGuid())
contact.FirstName = "Mary"
contact.LastName = "Jane"

customer.Contacts.Add(contact)
customer.Save()

Customers and Contacts classes were generated with SubSonic2.2. The contact is not being saved in the DB.


Maybe the answer is a little bit late but maybe that helps anyway. Subsonic's Save() method only persists the current object by design.

You can either do:

customer.Contacts.SaveAll();

or

customer.DeepSave();

instead.

0

精彩评论

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