I am new to MVC, and am really struggling with what I seems like it should be a very common scenario. I'm using MVC2 RTM, and the Entity Framework for my model objects.
What I have working:
An edit view for a parent object that contains a collection of child objects. The form displays all the editable fields for the parent, and iterat...
I have an entity class with a bunch of non-nullable string properties. If I try and set one of these to null, I get a ConstraintException and the message "This property cannot be set to a null value."
Without setting tracker variable to the name of each property before assignment, is there a way I can determine which property assignmen...
I have a parent object book, and a property of that object is publisher. Everytime I ad a book, it is adding a new publisher, even if the publisher already exists. Can someone tell me how to add the book and instead of adding the publisher again, just reference an existing one? The code i am using is below... Thanks in advance!
publ...
Here is part of my Entity Model which I just generated from a MySql database. My question is why are the tables UserNotes and UserLoginHistory coming out as Zero to One. When I change them to many (collection of usernotes) I get the error:
Error 1 Error 113: Multiplicity is not valid in Role 'user_notes' in relationship 'UserIdFKeyNo...
Hi All:
How i can make a decision to use Linq or Entity Framework as data access layer and business logic layer from performance
viewpoint (execution time , roundtrips ).
...
Hey. Nooby question but new with Entity.
I am trying to create a new user object and some details in some additional tables which have a foreign key of the newly created user id.
I've attempted to do this in one round trip. Do I have to add the user to the database first and then go back, set the userid's on the other objects and add t...
Hi all..
I'm doing data binding with entity framework. I have three master-detail-sub models: Customers, Orders, and OrdersDetails.
This would be run fine and data binding doing great:
this.customerBindingSource.DataSource = context.Customers.ToList();
But sure that would return all columns. How can I return specified columns and sti...
Hello
I have a table Item (ItemId int PK, Title vc, Description vc)
I created a testing view called ItemView: SELECT * FROM Item.
I added this view to my model, removed all the keys but the real key, added a 1-1 association, and mapped it, but I get 2 errors:
The table/view 'dbo.ItemView' does not have a primary key defined. The key...
I want to use Entity SQL to query the elements of some subtype in my Entity Model. For instance...
SELECT VALUE c FROM Persons AS c
WHERE c is of (Customer)
no problem meanwhile, but if I try the following query where Active is a property of Customer entity...
SELECT VALUE c FROM Persons AS c
WHERE c is of (Customer) AND c.Active == ...
Possible Duplicate:
Entity Framework vs LINQ to SQL
Hi,
What is the use LINQ to SQL though EF is supporting the SQL Server?
Moreover, suggest me when to use LINQ to SQL and EF ?
...
When I have a parent Entity hold a list of other entity (one to many relationship), I modify this list then call function to save the parent Entity. With the entities has removed from this list, is that the framework will delete them from database? And also the new entity has added to the list will be added to database?
thank for your he...
I have a stored procedure which uses a couple of tables and creates a cross-tab result set. For creating the cross-tab result set I am using CASE statements which are dynamically generated on basis of records in a table.
Is it possible to generate an entity from this SP using ADO.NET Entity framework? Cuz each time I try Get Column Info...
Hi, extremely sorry for writing here, I'm a php guy, been doing .NET MVC for like three days, although I had experience with C# some time ago. Anyways, I'm doing a simple website with shops and news stories. A news story could be either a global one, or tied to some shop. I use ShopId in the News table which can be 0.
What I'm trying to...
i have many tables : customers, prospects, friends..
They all have some Notes.
Question 1:
Should i have one Notes Table shared with all the parent Tables.
OR
Should i have a NotesCustomer, NotesProspects, NotesFriends Tables ?
Question 2:
If the best solution is the first one then this general Notes table should then have a FK to th...
Hello fellows,
I have the following situation between these three tables:
Before I start explaining what I'm trying to accomplish here, let me clarify three things:
I drew the model on EntityFramework, but this is actually the database view. Just assume that the fields type match between tables;
I know that this database model suck...
I might be missing something, but a SQL Server 2008 R2 database as generated by Entity Framework 4 is missing the default values I configured via the EF designer.
Any ideas what I could be doing wrong?
...
Getting this error:
System.Data.SqlClient.SqlException : The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value.
My Entity objects all line up to the DB objects.
I found only a single reference to this error via Google:
http://ramonaeid.spaces.live.com/blog/cns!A77704F1DB999BB0!182.entry
Af...
Hi folks,
I'm making a simplistic trivial pursuit game. I'm not sure if (and then how) I can do the following with EF4 :-
I have a table structure as follows.
Table: TrivialPursuitQuestion
=> ID
=> Unique Question
=> AnswerId
=> AnswerType (ie. Geography, Entertainment, etc).
Table: GeographyAnswer
=> ID
=> Place Name
=> LatLong
...
I've seen http://stackoverflow.com/questions/3565249/ordering-sub-items-within-ordered-items-in-a-linq-to-entities-query which suggests that there is no way of getting the repository to return sub-items in an entity graph in a specific order.
If that's right, any thoughts on how to order the items in an EditorFor ?
i.e.
//This works ...
Hi everybody,
Entity Framework allows to map the result of a stored procedure to an Entity easily. What I need is to map an Entity to input parameters, so that instead of
context.SaveUser( user.FirstName, user.LastName, ... );
I can simply call it like this:
context.SaveUser( user );
What I really want is to isolate possible schem...