title: EF 4.0 and stored procedures: return business objects or complex types?
body: <p>I'm new to EF4 and I'd like to know what the best approach when using EF with stored procedures as part of the DAL. So far I have these two options:</p>
  
  <p>Option 1</p>
  
  <p>Using EF4, I can create a complex type that the EF will map my results from stored procedures. I can then return this complex type from the DAL layer and then convert it again into custom BLL object in the main application layer. This strategy is appealing to me since I would rely on EF4 designer to build the plumbing without me building parameters by hand. It also makes DAL stand alone without referencing the assembly that contains the business objects. The major issue that I see with this approach is the fact I have to sort of hydrate DAL complex type to BLL business object again. Not sure how it would affect the performance.</p>
  
  <p>Option 2</p>
  
  <p>Have DAL reference assembly that contains BLL object and then return BLL objects from DAL layer. I'm not really sure if this is the right approach for me. I would have to manually create stored procedure parameters and then iterate of DataReader to build business objects to return. It's doable, but I would rather let EF4 designer build me stored procedure plumbing. Also, it would seem to couple DAL with BLL assembly, which I'm not sure is appropriate.</p>
  
  <p>Would appreciate some comments on this and suggestions.</p>
  
  <p>Thanks!</p>