entity-relationship

Unable to determine a valid ordering for dependent operations?

做~自己de王妃 提交于 2019-12-11 00:23:52
问题 I have this model: public class ContentType { public int ContentTypeId{get;set;} public string Name{get;set;} public Lang Lang{get;set;} public bool IsPublished{get;set;} public int? ParentId { get; set; } public int UserId { get; set; } public virtual User User { get; set; } public virtual ContentType Parent { get; set; } public virtual List<ContentType> Children { get; set; } } It has a one to many relation to itself. And in Context I have this: protected override void OnModelCreating

EF4.1 (code first) - How to specify a composite relationship

北战南征 提交于 2019-12-10 21:34:46
问题 In Linq to SQL I could specify a relationship that didn't have to depend on the foreign keys and pks existing in the database, useful for creating composite relationships like this: public class Equipment_CableNormalised { ... [Association(ThisKey = "EquipmentId,PortNumber", OtherKey = "EquipmentId,PortNumber", IsForeignKey = false)] public List<EquipmentPort> EquipmentPorts { get; set; } } This then generated the sql similar to " .. join EquipmentPorts EP on EP.EquipmentId = blah and EP

Symfony 2 FOSUserBundle Relation to Products Table

扶醉桌前 提交于 2019-12-10 20:44:36
问题 I apologize in advance if this has been asked before. I have successfully setup FOSUserBundle. I am trying to setup "http://symfony.com/doc/current/book/doctrine.html" the product example from that link out of the documentation. What I would like to do is set it up so a specific user adds a product the User Id of the FOSUser that user is associated with that product. I have two bundles in the Acme folder Acme/UserBundle -> the FOSUser Setup and Acme/MainBundle -> where I am setting up

Update EntityKey Reference in Entity Framework

那年仲夏 提交于 2019-12-10 18:49:14
问题 I created an application that uses Asp.net, Entity Framework and Windows Workflow Foundation and everything works as expected. My asp.net page should start a Workflow that executes and update an entity passed to the workflow from the page. Everything works ok: i used Unit Of Work pattern to share the context between asp.net and WWF and my entity is successfully updated during the workflow... except a field that is modelled in my entity as a reference to another entity. Suppose this case. The

Oracle optional relationship

扶醉桌前 提交于 2019-12-10 13:20:03
问题 What is the proper way to define an oracle table who has an optional foreign key relationship with another table? For instance, some employee records have defined the country they are from (a FK from countries table), and some have not. 回答1: Just allow the column to be nullable (don't make it NOT NULL ) and create your foreign key as normal. The database will enforce the foreign key for any rows that contain a value in that row, but nothing will be enforced if the row is null. 来源: https:/

Why can't you just join in fan trap?

£可爱£侵袭症+ 提交于 2019-12-10 12:07:31
问题 I'm trying to understand what exactly a fan trap is. I don't understand why can't you know the account a sales rep handles? Can't you just join the tables Sales Rep, Branch and Account and find out? What am I missing? 回答1: You can join on the tables/relationships of a fan trap. It's only a trap if you think that the resulting table/relationship means something it doesn't. Of course, if you need the table/relationship you think it means then you are missing it and need to add it. Works_for(rep

Symfony and Doctrine - cannot remove item from collection (Many-to-Many relation with extra field)

大城市里の小女人 提交于 2019-12-10 11:09:43
问题 Good day everyone! I have a question about collection persistence in Symfony and Doctrine The short version I can add an item to collection (persist) via form, but can not remove (remove). The logics I need a possibility to add users to business trips. Each added user must have text description (like a objective for business trip). In fact, i have 3 entities: BusinessTrip BusinessTripUser (stores linked User id, BusinessTrip id and text field "description") User (vendor bundle entity) The

Extended Entity-Relationship Model to tables (subclasses)

独自空忆成欢 提交于 2019-12-10 10:17:09
问题 In the EER model there are subclasses entities. I was wondering what's the way to implement that in a real SQL Table or if there is any guide that might help me out to understand how to implement entities subclasses into tables that would help. Thanks 回答1: Martin Fowler's book Patterns of Enterprise Application Architecture covers solutions for subclassing tables: Single Table Inheritance Class Table Inheritance Concrete Table Inheritance These correspond to the options in the answer from

How to set up Primary Keys in a Relation?

最后都变了- 提交于 2019-12-10 09:57:02
问题 I wish to know how to correctly set up Primary Keys in a Relation . E.g. we have ER-diagram which contain elements: Key attributes Weak key attributes Identifying relationships Associative entities In order to translate it into Relational Model we should do some tricks. All elements above deal with Primary Keys of relations but they all are Natural Keys - so we can leave them as is or replace with Surrogate Keys . Consider some cases. Case 1 Key Attribute is a name - so it must be of type

Is there a way to get all managed entities from an EntityManager

a 夏天 提交于 2019-12-10 01:38:36
问题 I'm setting up a basic test data util and want to keep track of all the data that the EntityManager handles. Rather than just having a bunch of lists for each entity is there a way to grab everything being managed by the EntityManager in one fell swoop? So instead of this: EntityManager em; List<Entity1> a; List<Entity2> b; ... List<Entityn> n; cleanup() { for(Entity1 e : a) em.remove(e); for(Entity2 f : b) em.remove(f); ... for(Entityn z : n) em.remove(z); } I want something like this;