Hi all,
I'm in charge to migrate our own DAL to a solution based on Entity Framework 4 but, before I can do it, I need to be sure it's possible to translate all our "constructs" to this new technology.
One of the biggest issues I'm having is the possibility to read a field and build a custom type. Valid examples could be a bit mask sav...
I'm trying to get to light. In DDD approach we have Presentation Layer(UI), Application Layer(Application Services), Domain Layer and Infrastructure. I'm sure that anyone knows o short description on those 4 layers.
I know WCF feet in Application Layer(Application Services), and the Entity Framework .edmx model in Infrastructure Layer....
I am having some trouble with refreshing the related collection of entities.
Essentially the problem is as follows:
public class Student
{
public virtual ICollection<Lecture> Lectures { get; set; }
public void AddLecture(Lecture lecture)
{
Lectures.Add(lecture);
}
public void CancelChanges()
{
...
I have business logic that could either sit in a business logic/service layer or be added to new members of an extended domain class (EF T4 generated POCO) that exploits the partial class feature.
So I could have:
a) bool OrderBusiness.OrderCanBeCancelledOnline(Order order) .. or (IOrder order)
or
b) bool order.CanBeCancelledOnline(...
When I try to create my own POCO classes I get this error. This is only when I got a list of some kind or acsosiation like in this case the Author got Books. But it works great when I use the T4. I kinda like to create my own classes because then I could add my AddBook() to it.. so I highly appreciate if anybody know why..
Schema speci...
I wrote a few assumptions regarding Entity Framework, then a few questions (so please correct where I am wrong). I am trying to use POCOs with EF 4.
My assumptions:
Only one data context can exist for an EF diagram.
Data Contexts can refer to more than one entity.
If you have two data sources, say MS SQL server and Oracle, EF require...
Hi Guys,
Here's the scenario:
ASP.NET MVC2 Web Application
Entity Framework 4 (Pure POCO's, Custom Data Context)
Repository Pattern
Unit of Work Pattern
Dependency Injection
Service Layer mediating Controller -> Repository
So basically, all the cool stuff. :)
Flow of events for a basic UI operation ("Adding a Post"):
Controller c...
I'm using the CTP4 code first EF framework, but I'm having problems getting lazy loading to work. Reading up on it, it should be simple, but it's just not
public class Folder
{
public int Id { get; set; }
public string Name { get; set; }
public int? ParentFolderId { get; set; }
public virtual IList<Folder> ChildFolders...
Hi there,
I wonder if anyone can help me?
I am having problems understanding why i need to issues DetectChanges on my POCO (non proxy) entities.
Of course i have this line to ensure that proxies are not returned.
context.ObjectStateManager.GetObjectStateEntry(order).State
And doing some research it appears if i need to check the...
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 ...
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...
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...
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...
Could anyone tell me where is the best place to put my business methods when using EF4 code first POCOs? Should they go in the POCO class? E.g.
public class customer
public property Id as int32
public property Name as string
public property Archived as boolean
public sub MarkAsArchived
me.Archived = true
end...
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...
Hi,
Can someone point me the difference between POCO , Self Tracking Entities , POCO Proxies?
Actually, I am working Entity Framework 4.0 and POCO(Repository Pattern) and whenever I do some changes in the POCO and call ObjectContext.Savechanges then it reflects to the DB.
My question is,
How does the Context persist the change to t...
I am trying to understand how to create a complex POCO which in the backend tied to a stored procedure or multiple tables. All the examples I have seen are simple one table to one entity or two tables. Could some one point me to a link or example on how to create a complex POCO which talks to stored procedure or multiple table. Or is it ...
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 using Newtonsoft.Json.Linq and I'd like to load the data into objects (or structs) that I define and put the objects into a list or collection.
Currently I'm pulling out the JSON properties with indexes to the names.
filename = openFileDialog1.FileName;
StreamReader re = File.OpenText(filename);
JsonTextReader reader = new JsonTex...
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 ...