I'm trying to figure out if it would be possible to stick to the mantra "Program against an interface, not an implementation." while using the Entity Framework 4.0.
While I found a page explaining how to stick to aforementioned rule while using Linq-to-SQL (look here) I'm very keen to know if it would be possible to do that with the Ent...
We are planning to migrate to .net 3.5 and evaluating Linq To SQL and Entity framework. Considering what people are saying every where on internet that EF 1.0 is buggy, complex, has suboptimal designer support etc, if we pick Linq to SQL - do you think we will be able to migrate it to EF 4 when the time comes?
The question arises becaus...
We have an Entity Data Model which is used by a WCF Data Service that needs to run some business logic after persisting an entity to the database. In this case it needs to pass the id generated for the persisted entity to another service via a WCF web service call.
The question is how do we run some business logic after saving the enti...
I am using EF4 and I have create POCO objects with proxies from my database structure . I have a POCO (object) which has lots of relationships to other entities.
I created a deep copy of the object using DataContractSerializer and BinaryFormatter and lets call it clonedObject.
function used for cloning is:
public T CloneProxy<T>(T sou...
My client has a db table naming convention that requires me to prefix all tables with an application specific prefix - like "myapp_" - I am using EF4 with the model first approach.
I can specify a custom db namespace but they do not want to introduce a new namespace for this app - none of their other apps use namespaces other than dbo....
I am having a lot of trouble with 'base types' in the Code Only model of the Entity Framework. I am having a lot of trouble with 'base types' in the Code Only model of the Entity Framework.
When I try to run this code using a DbContext with a DbSet<Template>, I get the following error.
A The navigation property 'Flags' is mapped t...
EF + WCF Ria Service:
Suppose I have entity People, because it is a partial class, so I can extend it to add a method to it:
partial class People{
static string GetMyString(){
//......
return string;
}
}
then at client side, I want to method GetMyString available for entity People. what's the best way to implement this?...
I'm trying to get EF4 working with ncommon 1.1 which provides DDD patterns such as UnitOfWork, Specification, Repository.
The NCommon configuration line is throwing the following Exception:
SynchronizationLockException occurred
Object synchronization method was called from an unsynchronized block of code.
The actual code throwing the...
I want to get a connection string from the app.config file.
connectionString = System.Configuration.ConfigurationSettings.AppSettings["DBEntities"];
But it doesnt work. It's empty.
I cannot access the System.Configuration.ConfigurationManager because it's .net 4.
How can i get my connection string from the app.config?
Thanks
...
If I have an entity framework 4 context, normally if I have run a query like:
db.Invoices.Where(I => whatever);
and then later run something else:
db.Invoices.Where(I => something_else);
any objects returned from the second query, which were also returned from the first, will not be loaded from the database. EF will just take the ...
I have a couple of questions about good design with EF4 in an ASP.NET MVC 2 project.
First, validation. Should I place my form validation within my entities' SavingChanges events? How would I obtain the form data within the partial class? Or is there a better way to do it?
Second, maintaining logged in users. I come from a PHP back...
I'm trying to build a relatively simple game review site. There should be a 1-to-1 relationship between games and reviews (each review is for one game, and there will only ever be one review for a game). My tables are pretty simple. The relevant parts are:
Reviews Table:
ReviewID - int, primary key
Text - text
GameID - int, foreign k...
I installed the ODP 11 lateset version, which suposed to wupport EF4.
But when i'm trying to add entity data model in the VS2010, I don't have the option to select Oracle Database.
Is there anything else i need to do?
Also, I have running on my pc Oracle Express 10g - Is the 11 ODP will work with this DB?
...
I've been doing some playing around with POCO objects and EntityFramework. Because of this I have to write my own Context and Repository(s). I would like all repositories to use the same context instance so changes are shared between them. To facilitate this I coded my Context as a Singleton. This way instead of getting a new context and...
This questions stems from a n-tier application. (non-WCF - only separate assemblies)
Should I use a unitofwork pattern and keep my object context around for entity change tracking?
or
Should I use self-tracking entities and always dispose my object context after a query, insert, delete, etc... and have the entities track themselves...
From what I can tell in order for an object to be self tracking it needs to implement IObjectWithChangeTracker. Entities out of the box (made with EDMX generated code) implement IEntityWithChangeTracker.
Is there any way to make a EDMX code generated entity self tracking?
Thanks!
...
I have an entity 4.0 model that is using a SqlServerCE database as its provider. On the server I want to use the same project and just switch out the connection string to use the actual SqlServer database.
Here is my connection string
<add name="Entities"
connectionString="metadata=res://*/Entities.csdl|res://*/Entities.ssdl|re...
I am running the following query...
(from txRx in TxRxes
where txRx.Serial == "someSerial"
select txRx).Single().TxRxModes.Count()
When I run this on the database using EF4 in LinqPad, I get the correct result of 1 back. When I run exactly the same query on the same database through oData (using the same underlying context) I get 0.
...
Hey guys,
Is there anyway to make a dynamic fetch in entity framework 4
If you have some inheritcance where a and b inherit from c
Can you call one linq query to get a list of a, and b using the data set for c?
...
I am using EF4 with WCF and POCO.
I removed all virtual keyword in POCO entities.
I have Employee and Team entities and relationship between both is 1:N, means that one employee can be allocated only one team.
And I'd like to add new employee with existing team.
Following code is in the client side.
private void btnAdd_Click(object se...