This question is locked. New answers and comments are not allowed.
Hi all,
I'm trying to create a record inside a database table, named 'Offer'.
I'm used to doing this as follows:
For some reason I´m getting an exception when executing line 4.
I know this works with the entity framework, but will this work with ORM?
Anybody has an idea?
Daniel
I'm trying to create a record inside a database table, named 'Offer'.
I'm used to doing this as follows:
| // Create a new instance of an offer and fill the properties | |
| Offer offer = new Offer(); | |
| offer.Username = o.Username; | |
| offer.Material.MaterialId = o.Material.MaterialId; | |
| offer.MaterialCompletion.MaterialCompletionId = o.MaterialCompletion.MaterialCompletionId; | |
| offer.Washup.WashupId = o.Washup.WashupId; | |
| offer.WashupCraneHoles = o.WashupCraneHoles; | |
| offer.HotPlateSaving.HotPlateSavingId = o.HotPlateSaving.HotPlateSavingId; | |
| offer.KitchenSetup.KitchenSetupId = o.KitchenSetup.KitchenSetupId; | |
| // Add the new instance to the database | |
| Scope.Transaction.Begin(); | |
| Scope.Add(offer); | |
| Scope.Transaction.Commit(); | |
| return offer.OfferId; |
For some reason I´m getting an exception when executing line 4.
I know this works with the entity framework, but will this work with ORM?
Anybody has an idea?
Daniel