I'm using VS2010, and I've download the C# POCO Entity Generator installed it, now I want to use it.
I can't read the toturial and I can't find any other good toturials, so I've had a go myself - I have created a model and then I'm creating new POCO Entity, but I got the bellow error:
Error 1 Running transformation: System.Reflection.T...
My understanding of the Entity Framework is that if it can answer a query from its cache, it will. My simple testing, however, shows repeated queries hit the database even though they were previously answered positively:
var u1 = context.Users.SingleOrDefault(u => u.Id == 1);
var u2 = context.Users.SingleOrDefault(u => u.Id == 1);
Th...
I need to change the value of a property when I query the database using EF4. I have a company code that gets returned and I need to translate it to another company code, if needed. So, there is a stored procedure that is used to do this currently. Here's the old select statement.
SELECT companyName, TranslateCompanyCode(companyCode) as...
In my previous question, I asked how I would design the database schema where 1 table (Comments) would reference 2 tables (Question and Answer). I was given the response to use one table for Question and Answer (SO uses Posts).
Now I am in Entity Framework 4. How can I set it up so that this one table (Posts) maps to 2 objects (Ques...
Hello,
In some instances, we may have PK/FK references duplicated, so entity A and entity B are in a PK/FK relationship, but 3 times. So entity A would have 3 FK collections and entity B would have 3 entity references. How does that work with the code-first template? Do you follow the naming convention of Entity Framework model/datab...
my application is using WPF for UI, WCF for WebService, EF4 for DataAccess.
I read some materials from internet and msdn that EF4 has self-tracking function using custom T4 template even if using together with WCF for ntier. Does this mean that lazy loading function is still possible with WCF?
Thanks
...
Consider an ASP.NET MVC 2 web application project that uses EF4 POCO entities and the repository pattern to store information in a SQL Server database. So far there are 3 projects, 4 if you count the database:
1.) Domain.dll, has no dependencies, exposes POCO's and repository interfaces.
2.) Storage.dll, depends on Domain, implements ...
I see that most of people interested in EF4 are MVC developers. So; for a MVC2 medium application that implements DDD (Interfaces, Repositories, Services, Entities and IoC):
Do you recomend separating the different concerns in layers and using Self Tracking Entities? (here I know that ObjectChangeTracker is not being used but I don't f...
in DB, a SP return a bit result. like:
declare @temp bit;
--......
return @temp;
in EF, impport this SP as function and return scarlars Boolean.
in domain service call this function as:
public bool CallSP()
{
var result = this.ObjectContext.MySp();
return (bool)result;
}
then get error as:
Cannot convert type 'System.Data.O...
Im using EF4 in VS2010, POCO's and the model-first approach.
My entity has the following properties: Id:Guid, Name:String, Created:DateTime, Modified:DateTime, Revision:Int32.
I create my entity, set the name and save it to the database using the EF4-context. This should set Id to a new Guid (works with Identity-SGP), Created set to no...
With EF and WCF Ria Service, domaincontext object provides following generaic method to load entity colloection:
DomainContext.Load<T>
Here T must be type of Entity, not allow primitive type like bool, Boolean,...
If I have SP function call return scarlars result, what't generic method to call those function at client side?
...
OK, so I feel dumb for asking this... but I am stumped.
I can't seem to create a project/unit for using the ADO.NET Entity Framework.
I looked for a project type that looked like it would match, but no go (closest I could find was ASP.NET Dynamic Data Entities Web Application).
I also tried to just add a unit (like you do for Linq-to...
Hi All,
I have been working with Entity Framework 4 recently, and am slightly confused as to when to use ObjectSet.Attach, and ObjectSet.AddObject.
From my understanding:
Use "Attach" when an Entity already exists in the system
Use "AddObject" when creating a brand new Entity
So, if i'm creating a new Person, i do this.
var ctx = ...
Are entities required to be mapped to a table or can they map to a stored procedure?
I have an entity that does not map to any specific table, instead it maps to a stored procedure.
I am getting the following error:
Schema specified is not valid. Errors:
Model.msl(6,6) : error 2062: No
mapping specified for instances of the
...
I can't seem to update my database from disconnected poco objects. In this example, I fetch an ApplicationUser object, update varchar(100) field SSOID, but no changes take effect. Even when I refetch the object in the save method, nothing gets sent to the db.
If I try to call ApplyCurrentValues, it throws
An object with a key that m...
Im having trouble with the DDL-generation from EDMX using the "Entity Designer Database Generation Power Pack" add-on. It generates datetime-columns instead on datetime2 even though ProviderManifestToken is set to 2008. Can it be fixed? I don't want to do this manually all the time because Im using the model-first-approach...
...
I have a t4 template wich generates my poco classes. Everything is working fine.
Now, i want to inherit those classes from EntityObject (i want to know about EntityState sometimes) but when i do this, the relationships are always returning null (lazy loading not working). Any suggestions ?
Here is a simple model
public partial cla...
I am using Visual Studio 2010, C#, Entity Framework 4 and Oracle 10g.
I need to be able to return the result of a database function as a scalar property of an anonymous type.
My Oracle schema has two tables, PARENT and CHILD, and a function FNC_ADD. I have created an entity model using the Visual Studio ADO.NET Entity Data Model templ...
Hi all,
I have question about Entity Framework. I did a search here but could not find a very good solution. I maybe be using EF in a strange way that is not typical.
Basically I declare a context on the start of my appliction and load the data I need. I'm using MVVM design patern for a C# WPF desktop application with a SQLite backend...
I need to execute a SQL stored procedure every time before I query my ObjectContext. What I want to achieve is setting the CONTEXT_INFO to a value which will be later on used with most of my queries.
Has anyone done that? Is that possible?
[EDIT]
Currently I'm achieving this by opening the connection and executing the stored procedure...