I've been looking for an example about how to build an one-to-one relationship in EF4v2 with POCO's. I found a lot of examples that show only how to create one-to-many or many-to-many. Do you have any resource about it?
...
Hello,
I am using a generic code for my repositories on top of entity framework v2:
public virtual void Save(T entity)
{
using (C context = new C())
{
string entitySetName = context.FindEntitySetByEntity<T>();
T entityInDDBB = GetEntityByKey(entity, entitySetName, context);
...
Hi, I am using entity framework 4 to create entities from DB.
I have 2 entity contexts to connect to db.
let's say context1 and context2
However, when I do the following steps,
1. get data from context1
2. get same data row from context2
3. update same data row to context1
4. get same data row from context2
context2 doesn't change ...
I have two tables, Reports and Visualizations. Reports has a field, VisualizationID, which points to Visualization's field of the same name via a foreign key. It also has a unique key declared on the field. VisualizationID is not nullable. This means the relationship has to be 0..1 to 1, because every Reports record must have a unique, n...
What is the best method to profile dynamic queries that the entity framework generates? I've been using Sql Server Profiler so far, but I was hoping that there's a better way in Visual Studio 2010.
...
I am re-writing this question to make it clearer what I need to do. I am trying to use Rhino-Mock to test:
public IQueryable<TxRxMode> GetAllModes()
{
return m_context.TxRxModes.Where(txRxMode => txRxMode.Active);
}
Here's the code:
var context = MockRepository.GenerateStub<IProjectContext>();
//Returns an empty ...
Does VistaDB support 'Update model from Database' feature in EF4? I'm receiving this message:
" ... 'System.ArgumentNullException' 'Value Cannot be Null'
Parameter name: providerInvariantName"
...
This seems like it should be quite obvious but something about the entity framework is confusing me and I cannot get this to work.
Quite simply, I have three tables where the Id values are identity columns:
Users (userId, username)
Categories (categoryId, categoryName)
JoinTable (UserId, CategoryId) composite.
In the entities designe...
Using EF 4.0 Code only i want to make an assocation between an abstract and normal class.
I have class 'Item', 'ContentBase' and 'Test'.
'ContentBase' is abstract and 'Test' derives from it.
'ContentBase' has a property 'Item' that links to an instance of 'Item'.
So that 'Test.Item' or any class that derives from 'ContentBase' has an...
lets assume I do create the entities and I want data binding + error validation in wpf with mvvm pattern. Where is the advance of Poco? POCO is naked and has nothing... no INotifyPropertyChanged or IDataErrorInfo. Due to way much cumbersome work I do not wrap my entities like Customer in CustomerVM/CustomesVM (collection) etc... I return...
I have a pretty simple console project with an entity model (containing two simple entities), two handmade POCOs and a handmade Context class. The program fires a simple query against the DB and everything including LazyLoading works fine.
The problem: As soon as i add another Entity data model (even if i add an empty one), the calls t...
In the context of Entity Framework 4, the default behavior when adding a function import is to call it via ExecuteFunction<T>(), where T must apparently implement some property change notification stuff. (In my case it's generating a complex type derived from ComplexObject.)
I don't need or want any change notifications, and I'm requir...
I see examples about code-only POCO for en entity framework 4, but I cannot find the classes EntityConfiguration and ContextBuilder and I cannot see which reference I need to add to have them.
Is it part of the .Net Framework 4 or do we have to download something else?
...
Hi,
I have encountered an exception when I using Entity Framework 4.0 RC.
My Entity Framework model is encapsulated in a private assembly whos name is Procurement.EFDataProvider and my POCO are inside of another assembly Procurement.Core
The relation between Core(Business Logic)and EFDataProvider(Data Access) is with a factory named Data...
I'm working on a small Windows Form application that will be run on a Netbook computer. I will control the hardware/environment, meaning I provide the hardware and software to the end user. It will have a single database on the local drive that only this one app will access. It will have a couple tables and a few hundred (or maybe a c...
Hi,
While reading an article on EF 4, I read that EF pluralizes certain objects (EntitySet's, Navigation's pointing to EntityCollection's, etc.), while using the singular form for other objects. Out of curiosity - how does it do this ? Is it using a built-in dictionary ?
Thanks,
Scott
...
Hi there,
I wanted to add a new property to one of my model (table). Basically its a property that doesn't exist in the database but i need to add it to my model so that the custom generation tool (self tracking entity generator) will create the the property inside the the custom generated file.
I added a scaler property, its a string ...
Hi there,
I wanted to create a new property on a table in my model.. Basically i have a table called contract which has lots of fields, but i want to add another field called client which will hold my other table called client..
I tried playing around with complex types but i don't know if this is it.... Then i found navigation propert...
Hi there,
I know that i can enter/add new properties via code manually into partial classes but i wanted to use the model to add my new properties - reason being is that i can control a number of different attributes like NULL and things like that... and of course the code generations works great..
I added some foreign keys manually ju...
Hi,
I am reading an article about Entity Framework 4.0 that states the following:
"The model's context menu has an option to 'Generate Database Script from
Model'. When you select this option you'll find that you do need to point
to an existing database. The script won't create the database itself,
just the schema, which means tha...