entity-relationship

Database Design Problem

I'm trying to design a database for a server and database inventory and I'm looking for a good database design. We have tables for server clusters, stand alone servers and databases. I would like to represent the following relationships in the database: A one to many relationship from cluster to servers. A one to many relationship fro...

Going from 2 to many in Rails

I have a Rails application that I'm in the process of designing. I have a separate model that needs to link to only 2 of one model. Specifically, my "evaluation"s have 2 "member"s, an evaluator, and an evaluatee. They also have a few other pieces of information, too but they should not be relevant to this. What is the best way to r...

Automatically update Last Modified Date in ASP.Net MVC app

General Info: ASP.NET MVC app using ADO.NET Entity Framework SQL Server 2005 I have a few tables that more or less have a hierarchical structure of mostly one-to-many relationships. Most if not all of them have a Last Modified column and my question is simply how best to go about making sure that this column is updated properly throu...

Need help with ADO.NET Entity Framework UpdateException.

I have in my Database a Contact table and a Phone table, in the phone table there is column "ContactId" with a key that references the phone to the contact. In the key options in the server I set its delete option to 'Cascade'. Now when I attempt to delete a contact using the context: Dim contact As Contact 'The contact I want to dele...

How do you model roles / relationships with Domain Driven Design in mind?

If I have three entities, Project, ProjectRole and Person, where a Person can be a member of different Projects and be in different Project Roles (such as "Project Lead", or "Project Member") - how would you model such a relationship? In the database, I currently have the following tablers: Project, Person, ProjectRole Project_Person wi...

DB Design: Favor Abstraction or Foreign-Key Constraints ?

Say we have this scenario: Artist ==< Album ==< Track //ie, One Artist can have many albums, and one album can have many tracks In this case, all 3 entities have basically the same fields: ID Name A foreign of the one-many relationship to the corresponding children (Artist to Album and Album to Track A typical solution to the pr...

Turn off constraints temporarily

I'm looking the way to temporarily turn off all DB's constraints (eg table relationships) I need to copy (using INSERTs) one DBs tables to another DB I know I can archive that by executing commands in proper order (to do not break relationships) But it would be easier if I could turn off checking constraints temporarily and turn on it...

Linq To Entity SelfReferencing Relation Mapping

How do you map a table called category with Id as Primary Key which has self reference called ParenCategoryId using LinqToEntity? ...

Question about 3rd Normal Form

The following table : EmpId State Zip 1 FL 342008 2 CA 342001 is not in 3rd normal form because State is dependent on the primary key(EmpId) transitively. So, if I break it like this : (EmpId,State) (State,PIN) it's in 3NF. I could also break it like : (EmpId,State) (EmpId,PIN) and it will again be in 3NF. Bu...

ER Diagrams

Hi Just wondering whats the difference between ER Diagram 1 and ER Diagram 2? Thank You ...

Circular database relationships. Good, Bad, Exceptions?

I have been putting off developing this part of my app for sometime purely because I want to do this in a circular way but get the feeling its a bad idea from what I remember my lecturers telling me back in school. I have a design for an order system, ignoring the everything that doesn't pertain to this example I'm left with: CreditCa...

asp.net mvc 1 to many saving post and upload files

I'm new in asp.net mvc. I'm using Linq to Sql and trying to do everything loosely coupled. I've two tables: News NewsFiles What I'm trying to do is save a news and upload its files at the same time. How can I create a news in conjunction with his files saving it to NewsFiles table? The Linq to Sql model is Ok, it includes the obj...

Creating an entity diagram of a database without any foreign keys

I need to create an entity diagram of a MSSQL 2005 database. Relationships are defined by using primary keys consistently, but there are no foreign keys anywhere. I tried Microsoft Visio's "Reverse Engineer" function, which of course failed due to the lack of foreign keys. Therefore, I need a diagram tool which doesn't solely rely on f...

Recommendation for a good entity relationship diagram building tool for occasional usage ?

Freeware is a plus. Could you also describe with one sentence why it should be good enough for occasional usage? Edit: You might check this cool link , providing more info about entity relationship diagrams and tools Edit: For the chosen answer couple of tips - click on entity even it looks like circle and type the name and Enter - it...

nHibernate: Saving new parent object while creating a child object

I am trying to save a record which has a many-to-one property mapping. I attempt to assign a newly created parent object here (or use an existing, but that works fine) but I get an error when it tries to add the ID of the parent object to the child's table. Saying it cannot add NULL to the table, which is true, but I thought nHibernate w...

How to determine where to place the foreign key in this scenario?

If I have two tables - Logins and Users, as follows: Logins LoginIdNo UserIdNo HashedPassword Users UserIdNo LoginIdNo Username Each login "has a user" and each user "has a login" but which "belongs to" which? Is it simply a judgment call or is there a clearcut formula for determining where the foreign key should reside? ...

How can I insert into tables with relations?

I have only done databases without relations, but now I need to do something more serious and correct. Here is my database design: Kunde = Customer Vare = Product Ordre = Order (Read: I want to make an order) VareGruppe = ehm..type? (Read: Car, chair, closet etc.) VareOrdre = Product_Orders Here is my SQL (SQLite) schema: CREATE ...

Configuring Entity Framework on a Database Undefined Foreign Key Relationships

For a variety of reasons the database that I'm working on (SQL Server 2005) doesn't have any relationships defined. Every table has a primary key. And most tables have at least one foreign key, however we've never configured the constraints. Can anyone tell me the steps that I should take to inform Entity Framework of the underlying rel...

Entity Deletion Strategy

Say you have a ServiceCall database table that records down all the service calls made to you. Each of this record contains a many to one relationship to Customer record, where it stores which customer made the Service Call. Ok, suppose the Customer has stop doing business with you and you do not need the Customer's record in your datab...

Knowing when to model domain relationships and how to handle contextual relationships.

Hi - I am new to Domain Modelling so forgive me for asking a couple of elementary questions. My first question is about knowing when to model domain relationships. I find sometimes I feel like all classes appear to be related in some way to most others and I am unclear about when I should model these relationships directly (by holding a ...