0

My projects structure is as follows

DAL - Class Library - EDMX File (but i dont want to depend on Entity Framework either so it could be a Linq to SQL file) BusinessLogic - Class Library - ICustomer (Interface Class, Add, update, edit record) - CustomerService (Class that inherits ICustomer) - MyContextClass (A class that references the EDMX/DBML project above) Website - WebForms project

Recently we considered to introduce a new project i.e. it could be a phone app, desktop app etc.

After some research it seems the best way forward is to introduce POCO classes so each new app could use these classes to do the same.

  1. Do i need to introduce a new Class library with these classes?
  2. If yes and i introduce a new Class Library, how do i generate POCO classes especially when i have methods such as List<Customer> GetCustomers() within the BusinessLogic layer? Do i have to manually generate each property and replicate each column i have in the database table?
  3. In my DAL i have partial classes allowing me to have additional methods against a column i.e NormaliseCustomerName so when i use something such as

    c.Name = myValue.Name.NormaliseCustomerName();

against a textbox.

Would i need to move these into the POCO class. 4. Would be great if anyone can give me a brief example as i have read a few tutorials but there seems to be differences between each approach.

Computer
  • 2,149
  • 7
  • 34
  • 71
  • Methods like 'GetCustomers()' seem to fit in a Service layer. You don't necessarily need to create a new project. But, yes, I don't think a method such as "NormaliseCustomerName()" would fit on the same class as the GetCustomers(). I do use sometimes the partial class for this kind of thing. Although I would create a class like "NameNormalizer" or something. – Kevin Amorim May 09 '20 at 18:46
  • If your database is developed first, then I would recommend you to generate model from Db using Db first Approach. Once Models is in your solution, You can add reference to those in your buisiness layer. – Vishal Pawar May 10 '20 at 11:40

0 Answers0