entityobject

EF EntityObject not updating databindings of relationships

两盒软妹~` 提交于 2019-12-24 03:04:35
问题 I'm using EntityFramework, WPF and MVVM in my application and got some problems with updating the databinding of relationships between EntityObjects. I was able to downsize my problem to only a few lines of XAML and I hope someone can help me as I'm still not very confident with EF and MVVM. Anyway, here we go with the simplified XAML: <DatePicker Grid.Row="2" Grid.Column="1" SelectedDate="{Binding Path=File.SentDate, StringFormat={}{0:dd/MM/yyyy}, Mode=TwoWay, UpdateSourceTrigger

Add item and update relationship in transitional table in many-to-many database Sql Server

社会主义新天地 提交于 2019-12-12 02:43:53
问题 --here was wrong model without association manyTOmany between A-B. corrected is in EDIT2-- A exists in database, B exists in database. I need only enter new C element with some Properties1 and Properties2 (and update collections of C in existed A and B elements) I tried many options, like for example this, but still somethings wrong (with ObjectOCntext and existed Key etc) void SaveNewC(C newC) { using (var context = new MyEntities(connectionString)) { var dbA = context.A.Where(a => a.Id ==

Loading partial entities with Linq to Entities

心已入冬 提交于 2019-12-10 14:31:34
问题 I am trying to load a partial entity with Linq to Entities: Dim contacts = From c In My.Context.Contacts _ Select New Contact With { _ .ContactId = c.ContactId, _ .Name = c.Name } I tried it and I get the following NotSupportedException: " The entity or complex type 'CompleteKitchenModel.Contact' cannot be constructed in a LINQ to Entities query. " Thanks 回答1: You'll have to use anonymous type: Dim contacts = From c In My.Context.Contacts _ Select New With { _ .ContactId = c.ContactId, _

Value vs Entity objects (Domain Driven Design)

痴心易碎 提交于 2019-11-26 21:19:37
I have just started reading DDD. I am unable to completely grasp the concept of Entity vs Value objects.. Can someone please explain the problems (maintainability, performance.. etc) a system could face when a Value object is designed as a Entity object? Example would be great... Reduced to the essential distinction, identity matters for entities, but does not matter for value objects. For example, someone's Name is a value object. A Customer entity might be composed of a customer Name (value object), List<Order> OrderHistory (List of entities), and perhaps a default Address (typically a value

Value vs Entity objects (Domain Driven Design)

人走茶凉 提交于 2019-11-26 07:54:43
问题 I have just started reading DDD. I am unable to completely grasp the concept of Entity vs Value objects.. Can someone please explain the problems (maintainability, performance.. etc) a system could face when a Value object is designed as a Entity object? Example would be great... 回答1: Reduced to the essential distinction, identity matters for entities, but does not matter for value objects. For example, someone's Name is a value object. A Customer entity might be composed of a customer Name