tagged [entity-framework-4.1]
TransactionScope, where is begin transaction on sql profiler?
TransactionScope, where is begin transaction on sql profiler? i need to do something like this on a transaction context ``` using(var context = new Ctx()) { using (TransactionScope tran = new Transact...
- Modified
- 9 Jul at 14:45
Why is .Contains slow? Most efficient way to get multiple entities by primary key?
Why is .Contains slow? Most efficient way to get multiple entities by primary key? I realise that I could do some
- Modified
- 30 Nov at 16:12
Entity Framework 4.1 InverseProperty Attribute
Entity Framework 4.1 InverseProperty Attribute Just wanted to know more about `RelatedTo` attribute and I found out it has been replaced by `ForeignKey` and `InverseProperty` attributes in EF 4.1 RC. ...
- Modified
- 28 Feb at 14:40
Get a list of elements by their ID in entity framework
Get a list of elements by their ID in entity framework How can I get all elements that are in another list by ID? I have List roles; I'd like to get all roles from the database that are in this list b...
- Modified
- 11 Feb at 11:44
How to set foreign key in EntityTypeConfiguration Class
How to set foreign key in EntityTypeConfiguration Class I just started to make EntityTypeConfiguration class and did following and in EntityTypeConfiguration cl
- Modified
- 21 Jan at 07:18
Ignoring a class property in Entity Framework 4.1 Code First
Ignoring a class property in Entity Framework 4.1 Code First My understanding is that the `[NotMapped]` attribute is not available until EF 5 which is currently in CTP so we cannot use it in productio...
- Modified
- 25 Nov at 16:45
EF Code First: How to get random rows
EF Code First: How to get random rows How can I build a query where I would retrieve random rows? If I were to write it in SQL then I would put an order by on newid() and chop off n number of rows fro...
- Modified
- 16 Oct at 02:7
Code-First Entity Framework inserting data with custom ID
Code-First Entity Framework inserting data with custom ID I am using code-first EF in my project and face issue when the data with custom id is being inserted. When I am trying to insert data with cus...
- Modified
- 4 Oct at 13:36
EF ICollection Vs List Vs IEnumerable Vs IQueryable
EF ICollection Vs List Vs IEnumerable Vs IQueryable so, my EF model has relationships and according to what I have seen in examples, those relationships should be done with virtual properties of IColl...
- Modified
- 9 Jul at 15:19
Can a DbContext enforce a filter policy?
Can a DbContext enforce a filter policy? I would like to pass a value to the ctor of a DbContext and then have that value enforce "filtering" on the related DbSets. Is this possible...or is there a be...
- Modified
- 10 Jun at 07:8
How to pass parameters to the DbContext.Database.ExecuteSqlCommand method?
How to pass parameters to the DbContext.Database.ExecuteSqlCommand method? Let's just suppose I have a valid need for directly executing a sql command in Entity Framework. I am having trouble figuring...
- Modified
- 29 Mar at 14:35
Dynamic Include statements for eager loading in a query - EF 4.3.1
Dynamic Include statements for eager loading in a query - EF 4.3.1 I have this method: ``` public CampaignCreative GetCampaignCreativeById(int id) { using (var db = GetContext()) { ...
- Modified
- 3 Apr at 20:41
How to delete a record with a foreign key constraint?
How to delete a record with a foreign key constraint? Started a new ASP.NET MVC 3 application and getting the following error: > The primary key value cannot be deleted because references to this key ...
- Modified
- 17 Mar at 18:16
How to configure many to many relationship using entity framework fluent API
How to configure many to many relationship using entity framework fluent API I'm trying to set up a many to many relationship in EF code first but the default conventions is getting it wrong. The foll...
- Modified
- 21 May at 13:22
Entity Framework 4.1 Code First Foreign Key Id's
Entity Framework 4.1 Code First Foreign Key Id's I have two entities referenced one to many. When entity framework created the table it creates two foreign keys, one for the key I have specified with ...
- Modified
- 13 Apr at 21:54
How to represent Bridge table in Entity Framework Code First
How to represent Bridge table in Entity Framework Code First I am trying to find out how I can represent a bridge table between two entities (many to many relation) I'm Using Entity Framework Code Fir...
- Modified
- 4 Jan at 00:0
How should I return an int from a stored procedure in entity framework 4.1?
How should I return an int from a stored procedure in entity framework 4.1? I am using Entity Framework 4.1 and do sometimes need to call stored procedures. Some of these return ints as return values....
- Modified
- 15 Nov at 15:41
Linq to Entities (EF 4.1): How to do a SQL LIKE with a wildcard in the middle ( '%term%term%')?
Linq to Entities (EF 4.1): How to do a SQL LIKE with a wildcard in the middle ( '%term%term%')? I want to search for this: and get this: where the wild cards would be the spaces. I know I could do a S...
- Modified
- 7 Oct at 15:17
Better way to query a page of data and get total count in entity framework 4.1?
Better way to query a page of data and get total count in entity framework 4.1? Currently when I need to run a query that will be used w/ paging I do it something like this: ``` //Setup query (Typical...
- Modified
- 12 Aug at 12:23
Code-first vs Model/Database-first
Code-first vs Model/Database-first I'm trying to fully understand all the approaches to building data access layer using EF 4.1. I'm using Repository pattern and `IoC`. I know I can use code-first app...
- Modified
- 29 Jun at 15:26
SQL "not in" syntax for Entity Framework 4.1
SQL "not in" syntax for Entity Framework 4.1 I have a simple issue with Entity Framework syntax for the "not in" SQL equivalent. Essentially, I want to convert the following SQL syntax into Entity Fra...
- Modified
- 24 Aug at 22:57
Using the lambda Include method in a compiled LINQ query
Using the lambda Include method in a compiled LINQ query I'm currently trying to optimize some of the LINQ queries in my program by precompiling them. Some of these queries make extensive use of eager...
- Modified
- 16 Nov at 22:35
Why does Entity Framework return null List<> instead of empty ones?
Why does Entity Framework return null List instead of empty ones? I'm pretty new in the ASP .NET MVC world. Maybe, that's the reason I can't explain to myself the cause of what is, for me, an annoying...
- Modified
- 12 Feb at 16:6
EF 4.1 OnModelCreating not called
EF 4.1 OnModelCreating not called I have a problem with EF 4.1 not calling `OnModelCreating` so that I can configure tables etc. I have an existing database. Here is my connection string: ```
- Modified
- 25 Jul at 15:59
How do I upsert a record in ADO.NET EF 4.1?
How do I upsert a record in ADO.NET EF 4.1? I'm trying to accomplish something really simple and I can't find how to do it using Entity Framework 4.1. I want a controller method that accepts an objec...
- Modified
- 28 Jun at 18:31