लगता है जैसे आपका बीएलएल डीएएल में जोड़े गए entity
कक्षाओं को उजागर कर रहा है। आपको बीएलएल में रैपर वर्ग (वो पीओसीओ) बनाने की आवश्यकता होगी और डीएएल से इकाइयों की बजाय उन्हें वापस कर दें।
यह संभव है कि आप हैं कर रही है:
// DAL
// .edmx file generated entities
public IQueryable<TableEntity> GetTableEntities()
{
// read from entity framework and return
}
// BLL
public IEnumerable<TableEntity> ReadTableEntitiesForUser(int userID);
{
var d = new DAL();
var entities = d.GetTableEntities();
// restrict to entites this user "owns"
entities = entities.Where(e => e.OwnerID.Equals(userID));
return entities;
}
// WebApp
var b = new BLL();
var myEntities = b.ReadTableEntitiesForUser(1234);
यह संभव है कि आप करना चाहिए है:
// DAL
// .edmx file generated entities
public IQueryable<TableEntity> GetTableEntities()
{
// read from entity framework and return
}
// BLL
public class TableEntityDTO
{
public int ID { get; set; }
public string Name { get; set; }
// continue on for each column in the table
// and make a DTO class for each table in your database
}
public IEnumerable<TableEntityDTO> ReadTableEntitiesForUser(int userID);
{
var d = new DAL();
var entities = d.GetTableEntities();
// restrict to entites this user "owns"
entities = entities.Where(e => e.OwnerID.Equals(userID));
// convert from "Entity Framework Object" to "BLL Object"
foreach(var e in entities)
{
yeild return new TableEntityDTO() { ID = e.ID, Name = e.Name };
}
}
// WebApp
var b = new BLL();
var myEntities = b.ReadTableEntitiesForUser(1234);
इस इकाई की रूपरेखा के साथ भेज दिया कि लिए सच है। नेट 3.5SP1 और लिंक-टू-एसक्यूएल के लिए, जिनमें से मैंने थोड़ा सा उपयोग किया है, यह ईएफ के नवीनतम संस्करणों के लिए सच हो सकता है, लेकिन कोड-फर्स्ट और अन्य चीजों के साथ इस अतिरिक्त डेटा-ट्रांस से बचने का एक तरीका हो सकता है फेर-ऑब्जेक्ट चरण, हालांकि एक सेवा ओरिएंटेड आर्किटेक्चर के साथ, डीटीओ संभवतः जाने का सबसे अच्छा तरीका है।
धन्यवाद @ नेट, डाटा-ट्रांसफर-ऑब्जेक्ट मिस गया और परेशानी हो गई। – inlokesh