Suppose I have an ObjectContext of some sort with Order entities in it. So I can fetch orders from DB with:
MyContext.Orders.Select(...);
I can create new orders with:
Order.CreateOrder(...);
And add them to context:
MyContext.AddToOrders(newOrder);
But when I add new order into context it doesn't show up anywhere. I can't find ...
We've been going back and forth on how we want to manage our ObjectContext for our MVC enterprise solution. We're looking for the pros and cons of storing your ObjectContext between requests opposed to creating one on each request.
Let's say we have product controller routed to from \site\product\edit\34. The edit action calls our rep...
Hi,
I have these entities (this is just an abstraction I created for this post):
Language
District
Description
These are the references between them:
District * - 1 Language
Description * - 1 Language
District 1 - 1 Description
If I fetch like this:
var myFetch = from c in context.Districts
where c.Id = 10
...
I have one solution with three projects.
DomainModel (C# Library with ADO.NET Entity Framework)
DomainModelTest (Unit Testing for Business Logic)
WebApp (Using DomainModel)
For some reason, I cannot even bring the view if I pass any of the objects in the DomainModel, not even simple. I get the error below:
Any ideas?
Compiler ...
I am trying to find proper place where can i get all updates regarding EF 4 as we are going to use it for our new project.
Is there any team blog for EF4 from microsoft?
Any other online source?
I am trying to get upto speed with EF 4 but just googling everywhere there seems to be old information and confusion me a lot.
...
Hi there,
Is it true that you cannot call an sp with the EF unless the sp returns an entity?
To test I created 3 Function Imports for an sp with 1. no return type 2. a scalar return type and 3. an entity return type
then when i type "DataContext" then "." I only get intellisense on the function that returns an entity!
I'm surprised t...
I'm trying to build a Silverlight App that accesses and presents data from a MySQL database. I'm trying to use Entity Framework to model the MySQL data and RIA Services to make the data via EF available to Silverlight.
My Silverlight App is showing the correct columns in the datagrid, but it does not show the data (alternate link to im...
I am trying to use a stored procedure in the entity framework that returns nothing. The stored procedure is purely for logging.
I added a function (right click -> add -> function import) which works ONLY when the return value is set to one of the entities. When I change the return type to be Int32, Bool or nothing, or any other value ...
I've got this function
public static AdoEntity.Inspector GetInspectorWithInclude(int id, List<string> properties)
{
using (var context = new Inspection09Entities())
{
var query = context.Inspector;
if (properties != null)
{
foreach (var prop in properties)
...
Hello,
I have the next EF diagram:
Image
and the code service:
[EnableClientAccess()]
public class DomainService1 : LinqToEntitiesDomainService<db1Entities1>
{
public IQueryable<Entity1> GetMaster1()
{
return this.Context.Master.OfType<Entity1>();
}
public IQueryable<Entity2> GetMaster2()
{
return t...
Hi All,
I have a long running process that integrates over a collection of incoming Entities to work out if the incoming entity is different from the entity in persistent storage.
When I first wrote this I retrieved each entity from the database that matched the entity I was comparing against, I also had some includes to pull in refere...
EDIT: Stub Entities Definition
I have two entity types Subscriber and AddOn
Their definition in data model is as below
Subscriber(#SubscriberID,Name,AddOnID)
AddOn(#AddOnID,Name)
AddOnID column in the Subscriber table references the AddOnID column in AddOn table.
I'm trying to update the AddOn reference of a specific Subscriber ...
I am getting this error when I try to do an insert on a column that is a foreign key. Here is how I am assigning the value
var at = MvcApplication1.Entity.alttitles.Createalttitles(0, altTitleText);
at.question.question_id = questionid; //Error here
at.userinfo.user_userid = _AuthorID; //Error here
context.A...
I have a product class (created from EF)
I have a user class (created from EF)
A user can have one to many products (UserProduct object created from EF with foreign keys)
What I want to do is
Create two Products (save off so they have IDs)
Create a User (don't save yet)
Create two UserProducts to reference to User
SaveChanges so th...
I'm trying to include two tables off of one base table, and provide a "where" statement on the second table, but I'm getting a very confusing error (below). Any thoughts on the issue/solution?
ObjectQuery<STATE> productQuery =
LeadsContext.STATE.Include("REGION")
.Where("it.REGION.BRAND.BRAND_ID = @brand", new ObjectParameter...
I need to refresh a bunch of EDMX files in my solution. We have disected our tables into groups and each model represents one component or process. However, there are some overlapping tables, which means sometimes I need to refresh/update multiple Entity Models.
Refreshing a group of different entity models in VS 2008 is slow and dang...
Hello, I am rewriting my application to use the entity framework. What I am confused about is the code I am writing looks like it is making unnecessary tripts the the sql server. For example, I have a question answer site similar to SO. When I add an answer to a question -- here is the code I use:
var qu = context.question.where(c => c....
I am having a little trouble understanding how entity framework works. I am reading "Entity Framework" by Oreilly for the second time. I am not sure if its me or the book that is the problem. But I have never had a problem reading any programming book probably with the exception of XSLT 2.0. Do you guys have any books or resources that i...
Hello
I have a small ASP.NET MVC application with the following entity objects:
Person
PersonId
Name (string)
FirstName (string)
Country (Country)
Country
CountryId
Name
I can add and delete the entity's this works fine. I can also update name, firstname.
But how can i update the country property with another country.
i was tr...
I have been using ADO.NET in favor of LINQ to SQL (or Entities) up to this point. I'm starting a new project that should be smallish, at least at first but I would like to have room to expand down the line.
I feel now is a good time to get into LINQ. I've avoided it for quite a while; however, I'm concerned by the current direction of...