I'm currently migrating an application from Linq-to-SQL & ASP.net Web Services (asmx) to Entity Framework and WCF.
My question is, I have a bunch of POCO classes which i have xml mapping files for (for the linq to sql)
I've replaced my linq to sql with an entity framework data model
I've got an interface - something like IService - tha...
I have two tables: [Category], [Item]. They are connected by a join table: [CategoryAndItem]. It has two primary key fields: [CategoryKey], [ItemKey]. Foreign keys exist appropriately and Entity has no problem pulling this in and creating the correct navigation properties that connect the entity objects.
Basically each category can have...
During DevConnections I veered off the Silverlight track and stumbled into an awesome talk by Chris Sells about EF4. I was really impressed by what is possible now vs 3.5 SP1. At the same time, I'm wondering what benefit there would be in taking a system that is a heavy POCO architecture and inserting EF4 in the mix. Change tracking? LIN...
HI, I am using the following code
from c in Country
where c.IsActive.Equals(true)
orderby c.CountryName
select new
{
countryIDCode = c.CountryID + "|" + c.TwoDigitCode,
countryName = c.CountryName
}
but following is the error while doing this...
Unable to cast the type 'System.Int32' to type 'System.Object'. LINQ to En...
These web articles uses separate Save() and Update() methods for saving and updating an entity.
How can I write a SaveOrUpdate() method in Entity Framework with the help of ObjectContext and in Linq-To-SQL with the help of DataContext?
That is, how can I write a single method that shall do both save and update job?
...
Take a look at this query:
var user = GetUser(userId);
var sessionInvites = ctx.SessionInvites
.Include("InvitingUser")
.Include("InvitedUser")
.Where(e => e.InvitedUser.UserId == user.UserId)
.ToList();
var invites = sessionInvites;
// Commenting out the two lines below, and it works as expected.
foreach (var invite i...
Hi,,,
When I need to use the complex type in entity framework?? or in other words what is the complex type used for ?
Thanks
...
Given an EntityType, such as "Contact", how can I derive from it the name of the EntitySet it would belong to, i.e. the pluralization such as "Contacts"?
...
In my research about rolling back transactions in EF4, it seems everybody refers to this blog post or offers a similar explanation. In my scenario, I'm wanting to do this in a unit testing scenario where I want to rollback practically everything I do within my unit testing context to keep from updating the data in the database (yeah, we'...
What are the key points to be considered when deviding the .edmx (Entity framework) to multiple files for a large database?
...
I have a question, much liket this unanswered one. I'm trying to work with the entity framework, and having a tough time getting my foreign tables to update. I have something basically like this in the DB:
Incident (table):
-ID
-other fields
Responses (table):
-FK:Incident.ID
-other fields
And and entities that match:
Incident (entity...
I have problems with saving derived type (TPT) with Entity Framework to database.
Let's say I have base entity Animal and derived type Dog.
I want to save Dog entity.
I thought that I could do it like contex.AddToDogs(), but contex contain only base entity - Animal. So I can only save Animal object - contex.AddToAnimals().
I have als...
I created an Entity Framework file. My database is called MyDB. My Entity Framework file is MyDB.edmx and I used an existing connection string (MyDBConnectionString) to generate the edmx model.
It created two more connection strings:
MyDBEntities
MyDBContainer
What are these for? They look exactly the same and both have the informat...
We want to use the Entity Framework (.NET 4.0) to build applications that can deal with Sql Server, MySQL and Oracle. And maybe Sqlite too.
It should be easy to switch the db vendor by some setting in a config file.
Is this possible? I prefer real life examples!
What kind of providers did you use?
...
I have run into a problem which have searched and tried everything i can to find a solution but to no avail. I am using the same repository and context throughout the process
I have a booking entity and a userExtension Entity
Below is my image
i then get my form collection back from my page and create a new booking
public ActionRe...
Hi all,
I have an existing SQL Server database, where I store data from large specific log files (often 100 MB and more), one per database. After some analysis, the database is deleted again.
From the database, I have created both a Entity Framework Model and a DataSet Model via the Visual Studio designers. The DataSet is only for bulk...
I would like hear how other's are effectively (or not) working with the Visual Studio Entity Designer when many database tables exists. It seems to me that navigating the Designer is tough enough to find what you are looking for with just a few tables but how about a database with say 100 to 200 tables? When a table change is made at t...
Assume I have a table and Entity Set 'Assets'.
In partial class 'Asset' I created new property, and in this property's getter I want to query database and based on the query results return something.
Can I query database from inside an Entity?
...
Using EF4. Assume I have this:
IQueryable<ParentEntity> qry = myRepository.GetParentEntities();
Int32 n = 1;
What I want to do is this, but EF can't compare against null.
qry.Where( parent => parent.Children.Where( child => child.IntCol == n ) != null )
What works is this, but the SQL it produces (as you would imagine) is pret...
I am using VS 2010 and I have an entity 'Person'.
The pluralization-service turns its plural to 'People', I want it to be Persons.
Is there a place where I can manage the pluralizations library?
...