I would like to group & order by in a query builder expression. The following query gets me close to what i want but the order by does not appear to be working.
what i have is an object that has unique ids but some will have a common versionId. I would like to get the last edited item of the same versionId. So only one item per versi...
I'm wanting to do a simple edit form for our Issue Tracking app. For simplicity, the HttpGet Edit action looks something like this:
// Issues/Edit/12
public ActionResult Edit(int id)
{
var thisIssue = edmx.Issues.First(i => i.IssueID == id);
return View(thisIssue);
}
and then the HttpPost action looks ...
Hello:
I can't figure out why calling SaveChanges() on the following code results in no changes to the objects I attached:
public void Update()
{
AccountUser accountUser = new AccountUser();
// update
using (var db = new MedicalSystemDBEntity())
{
var query = from user in db.AccountUsers
where user.id == this.Us...
In VS 2008, I have a simple .csproj that contains an Entity Framework .edmx (V1) file. Every time I build the project, the output DLL is updated, even though nothing has changed. I have reproduced this in the simplest-possible project (containing one ordinary .cs file and one edmx model). If I remove the edmx model and build repeatedl...
I have an EDMX containing Sentences, and Words, say and a Sentence contains three Words, say. Appropriate FK relationships exist between the tables.
I create some words: Word word1 = new Word(); Word word2 = ...
I build a Sentence: Sentence x = new Sentence (word1, word2, word3);
I build another Sentence: Sentence y = new Sentence (...
I am working on a project and I am using Entity Framework 4 as my ORM. I am implementing POCO classes. Every example I see with EF 4 and POCOs implements all properties with public setters. Is that the only way I can use POCO classes with EF 4? Do all my setters need to be public?
...
I am learning Entity framework and linq-to-entities.
It's possible to get cross values from multiple tables using JOINS (join keyword) or using the navigation fields ( associations) in which case the framework knows how to reference the cross data.
My question is what to use when?
...
I'm trying to make sense of a situation I have using entity framework on .net 3.5 sp1 + MySQL 6.1.2.0 as the provider. It involves the following code:
Response.Write("Products: " + plist.Count() + "<br />");
var total = 0;
foreach (var p in plist)
{
//... some actions
total++;
//... other actions
}
Response.Write("Total Products Che...
Hi,
I am trying my hardest to find the simplest way to create a basic "model first" entity framework example. However I am struggling with the actually generation of the database, particularly the running of the SQL against the database.
Tools
Visual Studio 2010
SQL Server 2008 Express
Process
Create a new class project
Add a ne...
Trying to wrap my head around the best approach in modelling a database when we are using Entity Framework 4 as the ORM layer. We are going to use asp.net mvc 2 for the application.
Is it worth trying to model using the class diagram modeller that comes with Visual Studio 2010 where you graphically configure your models into the EDMX f...
Hello,
Im trying to fetch an employee row from my database. The Employee tabel have a reference to a Job tabel.
Now i want to update a Employee row with some new info. I put the new info in a new Employee object and then use this object to update the old Employee information in the database. This worked great until i added the referenc...
I've been looking at the new Entity Framework 4 Code Only features, and I really like them. But I'm having a hard time finding good resource on the feature. Everything seems to be spread around blongs here and there, so this make me wonder if it's ready to be used for a serious project?
What do you think? Is it ready for production use ...
I know similar questions have been asked before.
I am starting with a set of xsd-generated data objects (plus the db model is there) and need to persist these almost 1:1 to a single SQL Server database. The number of entities is small (10), and the logic required for the db insert/update/delete (mostly upserts) is thin (albeit there is ...
I have Two Many-To-Many tables which I need to write a Entity Framework Linq query for. All I want to do is to retrieve any People from the "People" table who have a relation to the Company ID = 7.
Can someone give me an idea of what that would look like?
The tables look something like:
People,
ID PK,
Title,
Forename,
Surname
People...
I have just updated to using EF 4.0 where before i was using Linq 2 SQL.
I have a query:
var UserList = this.repository.GetUsers();
return Json(UserList, JsonRequestBehavior.AllowGet);
This was generating an error: "A circular reference was detected while serializing an object of type"
This prompted this code which worked f...
I have an entity name "Forum" with number of properties.
I also created a partial class "Forum" that encapsulates Extra properties like int PostCount.
List<Forum> lForum = null;
lForum= (from forum in Forums
join post in Posts on forum equals post.Forum into postsInForum
select new
{
...
Hello Everyone
I'm playing around with Entity Framework 4 and code only. The tutorial I'm following is using the Beta-Version of Visual Studio 2010 and is referring to Microsoft.Data.Entity.Ctp.
Since I'm working with the final release of Visual Studio the name of the dll must have changed.
Can somebody tell me how its name is now?
Che...
I've been following the walkthrough for creating your first WCF RIA Services Application from Microsoft and have encountered a problem when trying to edit and update data using the SubmitChanges() method of the Data Context.
The table being updated has an Identity Specification set in SQL Server 2008 on the 'CourseID' column. However t...
I can't seem to find the answer to what I think is an easy question. I have a Entity model I just created and I want to set the name of the table and the columns by hand. I can see the "mapping details," but how do I edit them or add to them?
...
What is the deal with Entities (when talking about the Entity Framework)? From what I understand, it is pretty much an in memory representation of a data store like sql tables. Entities are smart enough to track changes and apply those changes to the data store. Is there anything more to it?
Thanks in advance.
...