poco

Entity Framework 4 - TPT Inheritance in Features CTP5 (code first): rename foreign key column on inherited table

ぐ巨炮叔叔 提交于 2019-12-07 08:14:32
I'm trying to convert an xml Entity Framework model to Code First (CTP5) one. I have to model a hierarchy which fits quite well the TPT pattern. The only problem I have is that the primary key/foreign key of the "inheriting" table has a different name from the primary key of the base class. These are the relevant fields of the involved tables CREATE TABLE site.Domains ( ID INT NOT NULL PRIMARY KEY, Domain NVARCHAR(128) NOT NULL ) CREATE TABLE site.MainSites ( FKDomainID INT NOT NULL PRIMARY KEY REFERENCES site.Domains(ID) ) CREATE TABLE site.SisterSites ( FKDomainID INT NOT NULL PRIMARY KEY

POCO Class in EF not working as Expected

≡放荡痞女 提交于 2019-12-07 03:37:28
问题 I have created a DataBase in SQL and created an EDMX in Visual Studio 2012. It automatically created POCO (TT) classes. Everything looks fine. Now I change the column name of a table. I update the EDMX. Opening the EDMX in XML and everything looks fine. Question 1 After I ran Custom tool in TT, I see that a new property got created additionally, e.g.: SQL table name : Student Column name : sName In my POCO Class public int sName{ get; set; } got automatically created. Now I change the column

Entity Framework Skip method running very slow

♀尐吖头ヾ 提交于 2019-12-07 01:49:00
问题 I'm using Entity Framework 5, ObjectContext and POCOs on my data access layer. I have a generic respository implementation and I have a method that queries the database with paging using Skip() and Take(). Everything works fine, except that the query performance is very slow when skipping a lot of rows (I'm talking about 170k rows) This is an excerpt of my query on Linq to Entities: C# Code: ObjectContext oc = TheOBJEntitiesFactory.CreateOBJEntitiesContext(connection); var idPred = oc

What is the best way of using DTOs in a SOA application?

家住魔仙堡 提交于 2019-12-07 01:07:51
问题 We are implementing a SOA web application using EF, WCF and jQuery. Here is our architecture in a brief view: ------------- --- | UI | | | ------------- | | | Services | | D | ------------- | T | | Businsess | | O | ------------- | | | Dal | | | ------------- --- We know that we should have DTO classes to pass data between the layers specially between the Services and the UI but We have some conceptual issues about the way of using DTOs (to send to the UI or receive from UI). For Data-Driven

Entitity Framework: Change tracking in SOA with POCO approach

我是研究僧i 提交于 2019-12-07 00:26:45
问题 In our layered application, we are accessing database via WCF calls. We are creating and disposing contexts per request. Also we are using POCO approach. My question is, in pure POCO model (completely persistent ignorant POCOs) is it possible to track the changes, while we are creating and disposing context per request (as previous context is disposed in that service call)? If yes how EF handles this situation? As far as I can see 2 mechanisms (snapshot based change tracking and notification

What causes POCO proxy entities to only sometimes be created in Entity Framework 4

偶尔善良 提交于 2019-12-06 16:44:13
I have set up my POCOs and I have marked their public properties as virtual and I am successfully getting Proxies most of the time (95%) but randomly I am getting EF return some proxies and some non-proxies. Recycling the app pool when this happens will then fix this instance of the error and it will go away for an amount of time. Then it will re-occur in some other random (it seems) place. What can cause this sort of behaviour? alt text http://www.freeimagehosting.net/uploads/36c95af3c7.jpg Thanks, Kohan Solved it (im getting in the habit of almost giving up, posting here and then solving it)

Entity Framework 4.1 reverse engineering code-only

廉价感情. 提交于 2019-12-06 14:33:43
I am using Entity Framework 4.1 and want to take advantage of their code-only approach. In the video located at http://channel9.msdn.com/Events/TechEd/Europe/2010/DEV212 starting at 35:00 minutes in they show a tool that reverse engineers their POCOs from their existing database. I want to do this as I have an existing database. I have installed EF 4.1 and I can create POCO entities just fine but I can't seem to find the tool they used to create POCOs from the existing database. Was this tool not released with 4.1? Thanks in advance. The tool is called EF Power Tools CTP1 . If your database is

Entity Framework 4.1 DbContext generator problems

心不动则不痛 提交于 2019-12-06 11:04:20
I am new to Entity Framework 4.1 and I really wanted to transition to POCO classes for my model. I found that this was very easy using the "DbContext Generator" item provided when you install EF 4.1. It did exactly what I wanted it to do and generated the DbContext object and all the POCOs for my existing EDMX model. I ran the app and tested that it was still working. It was. Happy with this I deleted the EDMX file and the T4 templates and began reorganizing my new POCOs. However, after getting it to build properly again I encountered a runtime problem. When instantiating the DbContext it is

Can EF4 generate POCO for me, or do I have to write them myself?

断了今生、忘了曾经 提交于 2019-12-06 09:57:14
问题 I've been playing about with the Entity 4 framework lately and it's pretty nifty. I've setup a class called Customer.cs with some properties like Name, Address etc. I also have a class called StoreEntities.cs which binds these back to the database through DbSet. It works fine and I can pull all my customers from the database. The problem is every tutorial I come across on the internet generates their classes by hand. What I mean is, they all say something like "Now I'm going to make a new

Entity Framework Service Layer Update POCO

自古美人都是妖i 提交于 2019-12-06 07:49:57
问题 I am using the Service Layer --> Repository --> Entity Framework (Code-First) w/POCO objects approach, and I am having a hard time with updating entities. I am using AutoMapper to map my Domain Objects to my View Models and that works good for getting the data, no how do I get that changes back into the database? Using pure POCO objects, I would assume that there is no sort of change tracking, so I see my only option is to handle it myself. Do you just make sure that your View Models have the