HI ,
The designer creates Entity classes as partial when using LINQ to SQL and the Entity Framework. Is there some way we can create the Entity classes as .cs physical files while using LINQ to SQL or the Entity Framework
...
Hey Guys,
I have a Strange problem, been using EF for quite a time now but never came across such trouble, i have a table which is related to 15 tables.
Now the problem is that if i define all the relations my project becomes dead slow, it takes long time to build and run.
What could be the trouble? Please enlighten me
Thanks
...
I have generated an EDMX project, and I have my data entity classes set up. They all inherit from System.Data.Object.DataClasses.EntityObject. What I would like to do is have another abstract class that inherits from EntityObject, and then my data entity classes inherit from that new class.
What is the best way to accomplish this?
Th...
VS.net 2010/.net 4.0 RC was just released. For those who have used Beta or even the RC how easy/difficult is it to upgrade from entity framework 1.0 to 4.0?
Some things I'm wondering about:
EF1 didn't support foreign keys in the model. I read that EF4 does. I guess if we want to use foreign keys there will be code changes to make?
...
Within my database (SQL2008), I have a customer table and a country table (among others) and there is a foreign key relationship defined in the database between these tables based upon "Country.Id -> Customer.CountryId".
I have created an EF model using VS2010 RC and built this model from the database. When generating the model, I selec...
I have a class Post which is an Entities Framework model. It contains a property like this:
public bool Showable {
get {
return this.Public && this.PublishedDate > DateTime.now
}
}
I can use it in a query like this:
from p in db.Posts where p.Showable select p;
but when I have a property that uses it, like this
public IEnu...
I'm having some issues with the entity framework. I'm executing a simple select from a view in the database. However, when I view the SQL that EF generates, it is executing the query twice using a select from. Is this the way it is supposed to operate? It seems very inefficient.
var reads = (from rt in ctx.C2kReadsToTransfer
...
I have a simple DB that has Sites, and each Site has a bunch of Posts.
I'm trying to get all the "Public" Posts of a certain Site (I have a variable called site that is already an instance brought by EF)
The first obvious thing is:
var posts = from post in site.Posts
where post.Public == true
orderby post...
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...
so the story is like this.
I have a project, called PA.DLL, which have an entity model inside of it (edmx) file.
In another project which i'm referencing to the PA.DLL, i copied the connection string that was created (automatically) when creating the edmx file into the main app app.config.
however, when i load and run the following l...
I'm using the LINQ Entity Framework and I've came across the scenario where I need to access the newly inserted Identity record before performing multiple operations using procedure.
Following is the code sinppet:
public void SaveQuote(Domain.Quote currentQuote)
{
try
{
int newQuoteId;
//Add ...
Hello, I'm a newbie to StackOverflow so please be kind ;)
I'm using Entity Framework in Visual Studio 2010 Beta 2 (.NET framework 4.0 Beta 2). I have created an entity framework .edmx model from my database and I have a handful of many-to-many relationships.
A trivial example of my database schema is
Roles (ID, Name, Active)
Members (...
This seems like it should be quite obvious but something about the entity framework is confusing me and I cannot get this to work.
Quite simply, I have three tables where the Id values are identity columns:
Users (userId, username)
Categories (categoryId, categoryName)
JoinTable (UserId, CategoryId) composite.
In the entities designe...
I need to store localized entities in a database (for instance a Product, which has a Name, which is different in English and Danish). There are several well-known ways to do this, for instance having some sort of a resource table containing the values of the localized columns.
However, this does not seem to be very easy to fit into an ...
I retrieve a collection with the following query:
var numbers = _betDetailItem.GetBetDetailItems().Where(betDetailItem => betDetailItem.BetDetail.Bet.DateDrawing == resultToCreate.Date && betDetailItem.BetDetail.Bet.Status == 1).Where(condition);
Right there I'm able to access my navigation properties and navigate through binded info....
I'm using the EF in a WinForms app, my idea is to have an ObjectContext per transaction instead of a single long running context. But I'm getting an error when I try to attach objects from a previous transaction into a new one, something to do with the entity already being in another context.
I kinda assumed that entities got detached w...
I just installed the POCO Template for EF4. I have a single entity in my model, AnnouncementText, and the T4 files seem to be properly generated. Attempting to access this new entity is throwing the following error when I access the auto-generated property MyObjectContext.AnnouncementTexts:
InvalidOperationException: Mapping and me...
I added a reference to a stored procedure in my edmx file, then right clicked on it and selected "Create Function Import", it was added to the Function Imports folder under EntityContainer in the model browser.
As I understand it I should be able to use it like so:
sampleEntities db = new sampleEntities();
db.SampleStoredProcedure();
...
Tables: Article, Author, Comment (1 article and 1 author can have * comments)
In the database is 1 article, 1 author and 1 comment.
The problem is, that code
myBD my_bd = new myBD();
var articles = by_bd.Article;
works OK, I can see that an Author and an Article has 1 comment.
But that code
var comm = (from u in my_bd.Commen...
I have a edited RESTful wizard based upon Shoulders of Giants | A RESTful Wizard Using ASP.Net MVC… Perhaps? . This wizard has a CANCEL button which, when pressed, fires the code below.
// If the user cancels, drop out altogether
if (!string.IsNullOrEmpty(CANCEL_BUTTON)) {
Session.Remove(VACANCYWIZARD_SESSION_KEY);
repository...