self-tracking-entities

WCF, Entity Framework 4.1 and Entity's State

☆樱花仙子☆ 提交于 2020-01-06 05:39:06
问题 I am developing an application which will expose WCF services. I am using Entity Framework 4.1 at the DAL. The problem is when I load some entity (let say a Customer that has Order which in turn has OrderDetail). After loading it I make some changes in Customer, Order and OrderDetail objects (some new orders are added and some existing orders are removed/updated) and send the object graph to WCF service to update it as following. Customer oCustomer; using(var context = new MyContext) /

Are nullable foreign keys allowed in Entity Framework 4?

蓝咒 提交于 2020-01-02 03:12:10
问题 I have a problem updating a foreign key in an Entity Framework entity. I am using self tracking entities and have an entity with some relations where the foreign key is also present as a property (one of the new features of EF4). The key (an integer) is marked as Nullable and Concurrency Mode fixed. Specifically I have an Alarm entity with a many to 0..1 relationship to a confirming user. (a user may confirm several alarms, but an alarm can be confirmed by only zero or one users). The entity

Entity Framework Self-Tracking Entities not recommended by Microsoft

霸气de小男生 提交于 2019-12-31 10:34:12
问题 While looking at Microsoft's web site, I discovered that they no longer recommend using Self-Tracking Entities. Each link below is a MS resource that mentions not to use STEs: Shows what templates are available by the Entity Framework team: EF Designer Code Generation Templates Self-Tracking Entities Recommended technologies for N-Tier applications Does anyone know why Microsoft no longer recommends using STEs? 回答1: (NOTE: As I don't work for MS this is all conjecture based on their public

Using STE entities in WCF Client using Java Application Client

扶醉桌前 提交于 2019-12-25 08:58:13
问题 I have developed my DAL using Entity Framework (Self Tracking Entities). I have written a WCF Service which exposes some CRUDE operations on those STEs. I want to use my WCF service in a java application (client). Would the STEs work properly in my Java Client Application? I mean if the java client application makes some changes in my self tracking entity, will those changes be tracked? 回答1: No. STEs work only if you share assembly with their logic between server and client application. Once

How do I correctly use EF4 Navigation Properties?

泄露秘密 提交于 2019-12-25 01:23:14
问题 I've created a database using the EF4 model-first approach. In my model, there's an N-to-M relationship between two entities: I've filled my database with some dummy data, including 3 records of type Diagnosis and 3 records of type TreatmentSchema and associations between them. Here's the code snippet I used to do this: using(var container = new SmartTherapyContainer()) { var diagnosisA = new Diagnosis() { Id = Guid.NewGuid(), Name = "Diagnosis A" }; var diagnosisB = new Diagnosis() { Id =

DDD using STE vs POCO

旧时模样 提交于 2019-12-20 06:39:02
问题 Developing n-layered application with DDD (o better DDDD because we are using WCF) using Microsoft technology (where we have full controll of all component), the best choise seems to be STE vs POCO (this last one force the usage of DTOs). That's right? In your opinion make sense the usage of STE with DTOs where we need them? Thanks. 回答1: I really can recommend Julie Lerman's Programming Entity Framework. She goes in depth about simple poco's, dto's and Self Tracking Entities. Advantages and

Can a class inherit from Entity Framework class and still persist back to the DB using the inherited classes mappings?

偶尔善良 提交于 2019-12-19 11:24:49
问题 Can a class inherit from Entity Framework class and still persist back to the DB using the inherited classes mappings? I have received errors trying to derive from a 'Self-Tracking Entity' class when I try and SaveChanges stating that the Type does not have any mappings. I would have hoped since the Type was Inherited from the Entity class that it could also inherit the entity mappings somehow for this to work. Has anyone been able to get this to work? The scenario I am trying to support is

History in database using entity framework

本小妞迷上赌 提交于 2019-12-13 02:13:25
问题 I want to store history in my table. I have table Employee . Employee { [Id], [name], [phone], [isActive], [createdDate], [closedDate](default '23:59:59 9999-12-31'), [DepartmentId] References Department(id) } When Employee is changed, I retrieve original values by Id and do isActive=False, closedDate=DateTime.Now and then I save modified value as new Employee with modified original values. void UpdateEmployee(Employee employee) { ContextDB db=new ContextDB(); var employeeToUpdate=db

Can an entity be unloaded from entity framework's ObjectStateManager?

末鹿安然 提交于 2019-12-12 18:19:59
问题 I am using Entity Framework with Self-Tracking Entities over WCF. I have 2 entities, Customer and PriceMatrix with a many-to-many relationship (the customer can have many historic price matrices, and a matrix can be shared between a group of customers) The client has a single PriceMatrix which it updates and sends back to the server. The server needs to check if this PriceMatrix is shared among other customers before choosing to either update it, or duplicate it and update the duplicate. The

EF4 + STE: Reattaching via a WCF Service? Using a new objectcontext each and every time?

偶尔善良 提交于 2019-12-12 06:12:24
问题 I am planning to use WCF (not ria) in conjunction with Entity Framework 4 and STE (Self tracking entitites). If i understnad this correctly my WCF should return an entity or collection of entities (using LIST for example and not IQueryable) to the client (in my case silverlight) The client then can change the entity or update it. At this point i believe it is self tracking???? This is where i sort of get a bit confused as there are a lot of reported problems with STEs not tracking.. Anyway...