Entity and N-Level Architecture in C #

I have three tables as shown below

Emp
----
empID int 
empName
deptID


empDetails
-----------
empDetailsID int
empID int

empDocuments
--------------
docID
empID
docName
docType

I am creating an entity class so that I can use the n-tier architecture for database transactions, etc. in C #. I started creating the class as shown below.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace employee
{
    class emp
    {
        private int empID;
        private string  empName;
        private int deptID;

        public int EmpID { get; set; }
        public string EmpName { get; set; }
        public int deptID { get; set; }

    }
}

My question is that empDetails and empDocuments are associated with emp using empID. How to do this in the emp class.

I would be grateful if you can guide me for example.

thank

+5
source share
4 answers

Tables containing a foreign key usually provide more detailed information about an entity.

Both EmpDetailsand EmpDocumentsare another level of detail of your larger object Emp.

Emp, Emp.

public class emp {
    public int Id { get; set; }
    public string Name { get; set; }
    public int DepartmentId { get; set; }
    public IList<empDetail> Details { 
        get {
            return _details;
        }
    }
    private IList<empDetail> _details;
    public IList<empDocument> Documents {
        get {
            return _documents;
        }
    }
    private IList<empDocument> _documents;
}

NHibernate, SchemaExportTool XML ( ).

, , NHibernate, Fluent NHibernate (FNH), Linq to NHibernate.

, :

NHibernate:

  • ;
  • , NHibernate XML ( );
  • 25% 50% , NHibernate;

Microsoft Enterprise Library, NHibernate, , EntLib :

...

+1

, , :

http://msdn.microsoft.com/en-us/magazine/dd882522.aspx

http://msdn.microsoft.com/en-us/magazine/ee321569.aspx

http://msdn.microsoft.com/en-us/magazine/ee335715.aspx

EF4, , , EF4 LINQ. . .

, , empDetails empDocuments, emp empDetails ( IEnumerable) empDocuments. , , somesort , . , EF Oracle.

+2

Linq2SQL? .

+1

LINQ to Entities, Oracle. , .

0

All Articles