entity-framework

Dynamic Query with Entity Framework 4

Okay I'm new to EF and I'm having issues grasping on filtering results... I'd like to emulate the ef code to do something like: select * from order o inner join orderdetail d on (o.orderid = d.orderid) where d.amount > 20.00 just not sure how this would be done in EF (linq to entities syntax) ...

How to use collection with entity framework 3.5 in n-tier application?

I'm starting new project with EF 3.5 (Visual Studio 2008 SP1, .NET Framework 3.5 SP1) It's N-Tier application, one important aspect of this project is return collection of datums which I prefer to use IEnumerable. I also use EntityBag in this project and I found some problem. I can return collection from AppServer but I can't track any...

Entity Framework 4: Mapped Stored Procedure on Model with Additional Parameters

We've started using Entity Framework 4 for data access and have come across an issue or perhaps lack of understanding. Our current system is heavily reliant on Stored Procedures, these procedure contain some necessary business logic so we need to continue to use these when doing Select/Insert/Update/Delete. The issue we are having is t...

C# Entity Framework - Data bound combobox does not reflect changes made after .SaveChanges()

Hi everyone. Ok, this has been driving me nuts for the last two days! I'm new to C# aand have been teaching myself via writing a simple app. I have a simple form that comprises of a combobox and two text boxes. The combobox contains a list of the entities in the database table. The text boxes allow the user to add new entries. It is ...

Error using 'EF Tracing Data Provider'

I am Trying to incorporate 'EF Tracing Data Provider' into an existing MVC2 app using VS2010, .NET 4.0 in order to log all SQL commands. I have no interest at this time in the Caching provider. I beleive I have followed all the steps listed in the blog posting. BLOG POST My project does compile without error, however when I attempt to r...

Creating ObjectContext for AuthenticationService without username and password

I have used the Silverlight BusinessApplication template in VS2010. I have changed the AuthenticationService to use my own Authentication methods - the requirement is that the user logs into the system with their SQL login (no AD in the company). On login, I construct a SQLConnection, attempt to open it, then I get their details (fri...

Building an ObjectContext in EF Code First CTP4

I just upgraded to EF Code First CTP 4 and it looks like the ContextBuilder class was removed. I currently create my ObjectContext like so (in CTP 3): var contextBuilder = new ContextBuilder<ObjectContext>(); var connstr = ConfigurationManager.ConnectionStrings["MyConn"]; var connection = new SqlConnection(connstr.ConnectionString); var...

Good advices to use EF in a multithread program ?

Have you got some good advices to use EF in a multithread program ? I have 2 layers : a EF layer to read/write into my database a multithread service which uses my entities (read/write) and makes some computations (I use Task Parallel Library in the framework) How can I synchronize my object contexts in each thread ? Do you know a g...

Ordering Navigation Properties - Entity Framework

Is there a way built into the entity framework or commonly used pattern for ordering lazy loaded navigation properties to ensure no matter how they are accessed they are always in the correct order. I would like to avoid having to write properties or methods on partial classes if possible. Thanks for any help. ...

SQLite + Entity Framework 4.0 + Identity column/Autoinc does not work

Hello, thats my table: -- Original table schema CREATE TABLE [SchoolYear] ( [Start] datetime NOT NULL, [End] datetime NOT NULL, [Id] integer PRIMARY KEY ON CONFLICT ABORT AUTOINCREMENT NOT NULL ); my Entity in the EF designer has StoredGeneratedPattern set to Identity OR Compute and datatype is int64. Everytime I insert a...

Are there good third party EDMX generator/updater tools out there?

Are there good third party EDMX generator/updater tools out there? The visual studio EDMX is driving nuts. I constantly have to restart VS2008 in order to get the EDMX to properly update. Are there any tools out there people like? This is somewhat subjective but I figured it would be ok to ask nonetheless ...

Entity Framework in Layered Architectures

Hello, Recently I've read article "The Entity Framework In Layered Architecture" and there is written we can send EF-entities to client through WCF. But in many threads on Stackoverflow people tell that POCO(DTO)-objects should be used when we use WCF. And I have some questions. Why did Microsoft add DataContract attribute to EF-enti...

Which methods to close a compiled query

As we know you can't add an extra clause like .Where() or .First() to a compiled query, because that changes the query and forces a recompile. What I would like to know is which methods can be used to "close" a compiled query. I know most people use either .AsEnumerable() or .ToList(), but which other methods work as well? Can I use .A...

What do I need to reference here?

I write this piece of code with C# using ADO.NET Entity Framework. I found error in here var departmentQuery = from d in schoolContext.Departments.Include("courses") orderby d.Name // here select d; Error message is like the following: Cannot convert lambda expression to ty...

NotSupportedException at unboxing SQLite Int64 field with Entity Framework 4

Querying with Entity Framework 4 with a SQLite (v3) database through the sqlite.phxsoftware.com ADO.NET provider (v1.0.66.0), I'm facing the following NotSupportedException while casting the retrieved Int64 properties: Unable to cast the type 'System.Int64' to type 'System.Object'. LINQ to Entities only supports casting Entity Data Mode...

Which layer should host the LinqToSql entity files - In My Case

So i looked around a and didn't find anything that quite looks like what i'm talking about, i know some are similar but this is a more specific question. I'm working on project at home and using the entity framework as my ORM provider, when we work on project at my workplace we use NHibernate and have different DLL's set up for DM \ DAL...

Getting all changes made to an object in the Entity Framework

Is there a way to get all the changes made to a object in the Entity Framework before it saves all changes. The reason for this is that i want to create a log table in our clients database: so... Is there a way to get the current database values(old) and the new values(current) before changes are saved? If not, how can i achieve this ...

Adding custom navigation properties using SPs in .NET Entity Framework 4

My company uses stored procs for all SELECT operations so it's making it rather difficult for me to create sensible navigation properties. I'm not too concerned at this point whether they're lazy loaded or not. So for example I created an entity for Customer then created a FunctionImport to map GetAllCustomersSP to return a collection o...

Modifying the Portable Extensible Metadata project

I would like to modify the Portable Extensible Metadata project, but there is no source code. I do have the extension starter kit but the PEM project does a lot more than the extension kit. Can someone help? ...

.Net Entity Framework and Transactions

Hi, Being new to the EF, I'm really rather stuck on how to proceed with this set of issues. On the project I am currently working on, the entire site is heavily integrated with the EF model. At first, the access to the EF context was being controlled using an IOC bootstrapper. For operational reasons we were not able to use IOC. I remov...