To be clear, I am not asking for a side by side comparision which has already been asked Ad Nauseum here on SO. I am also Not asking if Linq2Sql is dead as I don't care. What I am asking is this....
I am building internal apps only for a non-profit organization. I am the only developer on staff. We ALWAYS use SQL Server as our Database…
I want to get IQueryable<> result when executing stored procedure.
Here is peace of code that works fine:
IQueryable<SomeEntitiy> someEntities;
var globbalyFilteredSomeEntities =
from se in m_Entities.SomeEntitiy
where
se.GlobalFilter == 1234
select se;
I can use this to apply global filter, and later…
In EF v1 when we used GetObjectByKey on our context object contrary to linq query it stored queried object in cache is there any change in EF v2 (.NET 4) ?
I recently ran across this open-source project: http://www.codeplex.com/Sculpture
Sculpture is a code-generator which allows you to design your domain model and then use persistence 'molds' such as NHibernate/EF and probably more to generate repositories. It takes care of all the mapping and Data access generation. It looks like it does…
I'm attempting to implement a repository pattern with my poco objects auto generated from my edmx.
In my repository class, I have:
IObjectSet<E> _objectSet;
private IObjectSet<E> objectSet
{
get
{
if (_objectSet == null)
{
_objectSet = this._context.CreateObjectSet<E>();
}
…
Hi all,
I have a silly question. I would like to know if there is performance deference in these two quries:
var cObject = from cust in entities.Customer
where cust.id == cid
select cust;
and
var cObject = entities.Customer.First( c=> c.id == cid);
My query return only one record as I am querying with the…
Hi,
is there any option when updating classes in EF4 Modeller to disable the drop
of all data and tables, just to append non existing fields and leave old tables and data
untouched.
I mean not to change every time on every little change to edit manual the SQL files.
Thanks.
I've got two entities, one named exercise and the other named workout. I would like to store several different exercises in each workout object.
What is the correct logic here? Create an array of exercises in each workout?
I have a complex inheritance structure in my data model. A majority of classes in my model (which is designed in VS 2010 with a DB generated by it after) are derived from 3 basic classes. And only these 3 classes can be found among the context members. How do I use all the derived classes at all?
I created classes:
public class Country
{
public long CountryId {get;set;}
public string CountryName {get;set;}
}
public class Profile
{
public long ProfileId {get;set;}
public string ProfileName {get;set;}
public Country Country {get;set;}
}
and configuration for Profile:
public class ProfileConfiguration :…
Hello,
Is it possible to limit the number of associated entities eagerly loaded with Include?
e.g.
I have Author and Book entities with a many-to-one relation
I'd like to load all authors and their last book
Thanks.
I am using EF 5 with migrations and code first. It all works rather nicely, but there are some issues/questions I would like to resolve.
Let's start with a simple example. Lets say I have a User table and a user type table. The user type table is an enum/lookup table in my app. So the user table has a UserTypeId…
I asked a question about this previously but my database structure has changed, and while it made other things simpler, now this part is more complicated. Here is the previous question.
At the time, my EF Context had a UsersProjects object because there were other properties. Now that I've simplified that table,…
Hi, i have 2 table (user, user_profile) without a explicit relationship in the sql db. and i can't add it to the db.
so, i can't do this:
db.user.include("user_profile")
the attribute in for the join is user_id
is possible do anything like this?
db.user.join("user_profile On user.id = user_profile.user_id")
…
Does anyone know how to return an ordered list of strings with null values last? I have something like this:
using(var context = new DomainEntities())
{
var result = context.Users.OrderBy(u = u.LastName).ThenBy(u = u.FirstName);
}
My problem though is that this query returns null values before non-null…
Hello, everyone!
Is there are an easy way to store some of entitie's properties in a column as a bulk, as XML or something? Querieng by those properties of course is not an option, but it still'd be valuble to be able to extend data model without database migration.
I am refurbishing a big CMS that I have been working on for quite a number of years now. The product itself is great, but some components, the Database and translation classes for example, need urgent replacing - partly self-made as far back as 2002, grown into a bit of a chaos over time, and might have…
I have a POCO (Plain Old CLR Object)
public Foo
{
public virtual int Id { get; set; }
public virtual Dictionary<string, string> Stuff { get; set; }
public virtual string More { get; set; }
}
Using the model first approach (i.e. I don't have a data model yet), how would I handle…
Quick question for everyone:
Do I need to include all the database table fields on my EF model?
For example; I've created a sub-model that only deals with tblPayment and associated tables. Now, I need to write a LINQ query to get some information about items. I would typically get this by…
I'm using a transaction to insert multiple rows in multiple tables. For these rows I would like to add these rows in order. Upon calling SaveChanges all the rows are inserted out of order.
When not using a transaction and saving changes after each insertion does keep order, but I really need…
I have 2 tables that I import to EF model.
First table has a property [section] that acts as foreign key to the second table.
When I map this property in model to the table and try to compile I get this error:
Problem in Mapping Fragments starting
at lines 158, 174: Non-Primary-Key
…