my context: Entity Framework 4.0 + WCF Ria Data Service + Silverlight 4.
Suppose I have entity People from EF, then I created PeopleVM like:
public class PeopleViewModel : ViewModelBase
{
public PeopleViewModel(){
//....
this._hasChanges = MyDomainContext.HasChanges;
}
private People _Peopl...
I would like to use a lazy-loading collection on a model, but I want Add/Remove functionality to be done through separate methods. So something like this:
class Model
{
protected virtual ICollection<Something> _somethings { get; set; }
public IEnumerable<Something> Somethings
{
get { return _somethings; }
}
public vo...
On the web site I am currently working on I decided to give EF4 Code First a shot. It doesn't seem to bad, although not supporting enums means the impressive points are negated by a simple short coming.
Anyway, the problem I have now is that I have a book object which has a collection of authors. When I click on a page where the book is...
Good afternoon-
I am developing a Silverlight application using LINQ to Entity Framework for the data access layer. My n-tier database model includes about 30 or so tables, with a number of multi-leveled parent-child relationships throughout. Recently began writing my data services and unit tests and have discovered a problem with the...
I'm using Self Tracking Entities and have a scenario where I have an entity that represents a table that we'll call table A. A is a parent to another table B which is also represented as an entity. On my WinForm I have 3 different binding sources that each represent different types of records from table B but all are children of table A....
Hi all,
I've got the following model and I want ShiftRequest and MissionRequest to have a single table in the DB.
public class RequestBase
{
public int Id { get; set; }
public DateTime? RequestDate { get; set; }
public int UserId { get; set; }
public virtual ICollection<Notification> Notificatio...
I do not have 'full' the version of MS SQL (SQL Express 2008) so I do not have the profiler tool.
I want to see the SQL generated by my Entity Framework code, but all of the examples I find use the
var x = from u in table
select u;
type of syntax; But most of my queries are more like ..
var x = context.Users.Single(n => n....
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...
Is there any option that allows to ignore sys tables when updating model from database?
In my case I always have sysdiagram entity and related objectset.
thanks in advance.
...
I have an entity with a foreign key relationship to an asp.net membership provider users table.
This portion of the model looks like this:
I can't seem to assign the foreign key relationship when inserting the Users table record, the record containing the foreign key to the aspnet_Users table. I keep getting the error:
An item w...
How do I make non persisted properties using codefirst EF4?
MS says there is a StoreIgnore Attribute, but I cannot find it.
http://blogs.msdn.com/b/efdesign/archive/2010/03/30/data-annotations-in-the-entity-framework-and-code-first.aspx
Is there a way to set this up using EntityConfiguration?
...
I have a solution where I have created self tracking entities using the RTM templates. I have split the entities and context between 2 projects so that I can reuse the type definitions as I plan to run client/server via WCF.
One of my service methods is required to return a graph of "Product" objects with child objects of "ProductSku" a...
How can you map an entity to a database view with EF 4 code first?
Is there a way to do this by deriving from the EntityConfiguration classes?
...
I'm developing a couple of media (video games, TV shows, movies) review sites and am having an issue designing the relationships between my data. Case in point:
I decided that having a base Content table would be a good idea for most of the data. My Articles, News, and Reviews tables could all point to the Content table. My current s...
Does the Entity Framework 4 have ordered collections?
For example my Order has a property that is a collection of OrderItems, but the order is important and I would rather not sort them before I access them.
See Nhibernate for an example:
http://stackoverflow.com/questions/1916350/set-bag-and-list-set-in-nhibernate
...
Hi Guys,
I have a very simple stored procedure which returns multiple record sets. All of the record sets have aliased columns so they all look the same.
E.g.
SELECT TOP 10 FooId AS Id, Name As Name FROM Foos
SELECT TOP 10 BarId AS Id, Name As Name FROM Bars
...
For my EF setup, i'm using POCOs and have my own DataC...
The error message :-
"The model backing the 'AddressBook' context has changed since the database was created. Either manually delete/update the database, or call Database.SetInitializer with an IDatabaseInitializer instance. For example, the RecreateDatabaseIfModelChanges strategy will automatically delete and recreate the database, a...
My entity name is "Contact" and my table name is "Contact". However, the default pluralization support is making EF4 to look for a table named "Contacts". Anybody has any idea on how to turn off the pluralization support?
This post has got some details on pluralization support. But still does not give me an answer.
I see the following...