KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I currently have an application which consists of: User Interface (web page) BLL (Manager & Domain Objects) DAL (DataAccess class for each of my Domain Objects). I use the following in the UI to search for a domain object. protect sub Button1_Click() { IBook book = BookManager.GetBook(txtID.Text); } Here is my BLL public class BookManager { public static IBook GetBook(string bookId) { return BookDB.GetBook(bookId); } } public class Book : IBook { private int? _id private string _name; private string _genre; public string Name { get { return _name; } private set { if (string.IsNullOrEmpty(value)) throw new Exception("Invalid Name"); _name = value; } } public string Genre { get { return _serial; } private set { if (string.IsNullOrEmpty(value)) throw new Exception("Invalid Genre"); _genre = value; } } // Other IBook Implementations } And finally here is my DAL public class BookDB { public static IBook GetBook(int id) { // Get Book from database using sproc (not allowed to use any ORM) // ?? Create IBook Item? // return IBook } How would one create a IBook Object and return it to the Manager? I'm thinking of returning a DataTable from BookDB to BookManager and having it create the Book Object and return it, but that doesn't seem right. Is there another way to do this? Edit: I decided to seperate each layer into a project and ran into a circular dependency problem in the DAL layer when trying to add a reference to the BLL. I can't access the Book Class or Interface or anything in BLL from DAL. Should i just use ado.net objects here and have my manager create the actual object from the ado.net
Tags (comma-separated)
Save Edits
Cancel