-1

I am presently trying to write a simple application that stores some client data. I understand the separation of the form Layer, Business Logic and Database access logic; however what I can not figure out is when you have accessed the data the best way to return the data from the DAL to the BLL layer and without to much work to the presentation layer.

I thought about using a class to store the data at the lowest level and have that returned through the various levels but this still seems a little messy and there is the problem of persistence in the respect that if the class is disposable so that it cleans up after itself the returned values are lost.

What I need is an example in c# that stores an ID, Firstname, lastname in a database called client using SQL.

As I said I know the basics and I have programming experience but this has completely eluded me as to the tidiest and most robust way of doing this.

Thanks for your time in advance.

FalloutBoy
  • 119
  • 1
  • 6
  • What is your question? For this site you need to ask a specific, answerable question about programming. – RBarryYoung Jul 11 '16 at 14:14
  • I am wanting to know the tidiest and most robust way of returning database values regardless of if it is one field or 200 fields from SQL through the various layers, Database, Business, Form in c#. – FalloutBoy Jul 11 '16 at 23:55

1 Answers1

1

Have a look at Entity Framework, Microsofts recommended data access technology.This will take care of your database access layer. Using EF objects you can perform your business logic and send data back and forwards to your presentation layer.

https://msdn.microsoft.com/en-us/data/ef.aspx

lithium81
  • 56
  • 3
  • Thanks for the response, I have seen entity framework but this is more about when you have data that is to be returned through the various levels of the application what is the most robust and tidiest way to do it while maintaining the model integrity. – FalloutBoy Jul 12 '16 at 01:54