Hi
I am trying architect a small project. I planning to have Data acess, Business Service, WcfService, UI Layer.
I am trying to use EF 4.0 and MVC 2.0.
My question is where to generate the entities and ObjectContext through EF.
I initially planned it in DataAccess. but to make entities available across all layer I have to reference ...
I'm trying to create an expression tree that's similar to performing subqueries like:
SELECT (SELECT Sum(Foo) FROM Bar1) - (SELECT Sum(Foo) FROM Bar2))
I'm trying to reuse 2 expression trees that are too complex to repeat.
What I have right now is 2 (simplified) expression trees:
Expression<Func<Bar, int>> SumBar1 =
(bar) => (fr...
To start with, I am a newbie in the world of WCF so pardon me if this sounds naive.
To my understanding , unlike ASP.NET based websites which use ADO.NET to communicate to the database, a silverlight based app always needs a WCF or RIA services to communicate to DB. We know that ASP.NET websites are not tightly coupled to the database ...
Hi All,
I'm new to MVC and Entity Framework, so this may be a relatively simple answer, but I've tried searching around so far and no luck.
I'm using the most recent versions of both tools to my knowledge (MVC 3 Beta and Entity Framework 4.0)
I'm just trying to set up a quick example. Logically, I'm dealing with events -- in this case...
Could someone guide me on this. I am using EntityFramwork4 , I want to get the ID of the last row of a table. Could someone having experience using this tell me , how can i get the last id from a database table.
...
Hi,
Im implementing application in which there is local database which uses SQL CE. Each time app starts there has to be synchronization between local database and server database (to have new values in dictionary tables).
Problem is that mappings are different in sql ce and sql server 2008 when using entity framework.
Is it common pr...
I have a WinForms application. I created an EDM from my database and called it Foo. Then, I deleted the model.
Now, when I try to regenerate the same EDM again from the same database, it doesn't allow me to name the newly generated model Foo. It says that the name Foo conflicts with a property in the application's settings.
I poked aro...
Im using an Indexed View which is an entity without any relations (relations to my table entities would be preferable but this seemed to be nearly impossible to achieve). This view consists of 4 FK's which together form the PK:
PortalID
CategoryID
BranchID
CompanyID
Now im joining this view to select a set of companies like this:
var...
Hello,
In my mvc asp.net application, I have various modules in that I have insert and edit functionality .
Some time I am getting this error:
at System.Data.EntityClient.EntityTransaction.Commit() at System.Data.Objects.ObjectContext.SaveChanges(SaveOptions options) at System.Data.Objects.ObjectContext.SaveChanges() at admin.chamb...
I use Entity Framework that contain view. And I have query:
var data = this.context.vwRevenues
.Where(x => x.revenue >= 0);
.OrderByDescending(x => x.year)
.ThenByDescending(x => x.month)
.Take(10)
.ToList();
This query return set of entities, but 1st entity equals 5th.
data[0] == data[4] // true
I take sql scr...
Hello,
I have two entities: Master and Details.
When I query them, the resulting query to database is:
SELECT [Extent2]."needed columns listed here", [Extent1]."needed columns listed here"
FROM (SELECT * [Details]."all columns listed here"...
FROM [dbo].[Details] AS [Details]) AS [Extent1]
LEFT OUTER JOIN [dbo].[Master] AS [Extent...
I am using Linq to Entity Framework 4, what I'm trying to do is build a query that finds all supplier entities that do not start with a letter, typically these are numbers, e.g. "1st Choice" I thought this would be trivial and wrote this:
var letters = Enumerable.Range('A', 26).Select(x => (char)x);
var results = from supplier in All()
...
How do I get the trace string for a query like this:
var product = _context.Products.Where( p => p.Category == "Windows" )
.SingleOrDefault();
// I can't do this since product is not an ObjectQuery instance
// product.ToTraceString();
...
Let's say you have the following tables:
Friend
------
Id int not null (primary key)
Name nvarchar(50) not null
Address
-------
Id int not null (primary key)
FriendId int not null (links to Friend.Id)
City nvarchar(50) null
Country nvarchar(50) not null
Using Entity Framework 4, I am issuing an ObjectContext.ExecuteStoreCommand call ...
Hi
I have the following situation:
role.Permissions.Add(permission);
objectContext.SaveChanges();
When I now take a look in the relations table Roles_Permissions the newly added permission to the role is not present. It only saves the new relation when I dispose the object context. Am I doing something wrong or does a call to SaveCha...
How do I sort the inner collection of an object returned by the entity framework?
public class X
{
public string Field {get; set;}
public EntityCollection<Y> Ys {get; set;}
}
public class Y
{
public string Field {get; set;}
}
from x in entities.Xs
orderby x.Field
select x
Is there a way to modify this LINQ query to return t...
Hi,
I'm working in a disconnected scenario, but I noticed that disposing an object context does not release attached entities. As a result, subsequent operations often fail because of this.
So to solve this, I detach everything myself when the object context is being disposed:
public void Dispose()
{
// detaching is not really need...
Hi,
I was able to generate pocos using POCO template from Microsoft. It works great.
My question is how I could modify this or any other template to use existing objects from a different assembly, and just load data into them.
The way i tried going about it, was to create POCO's using the template, and the PocoGenerator.Context to ...
Is this a design choice by Microsoft, or is there a way to do it, that I'm not aware of?
...
I have not hardly touched EF4, but I've used Linq to sql quite a lot. I would like to start into one of the EF templates but I have no idea what situations make sense for each or what their intent was.
I have the following possibilities:
Data templates
ADO.NET Entity Data Model
Service-based Database (is this even related to EF?
Cod...