Skip to main content

Posts

Showing posts from December, 2016

#AT Repository and Unit of Work Pattern - 7

Presentation project create a WCF service application by right clicking on solution. we will get Service1.svc and IService1.svc. rename the service if required. change the web config. <endpointBehaviors>         <behavior>           <webHttp />         </behavior>       </endpointBehaviors> <services>       <service name="ContactMangWCF.ContactManagerService" behaviorConfiguration=" myBehaviour ">         <endpoint address="" binding="webHttpBinding" contract="ContactMangWCF.IContactManagerService"></endpoint>       </service>     </services> <serviceBehaviors>         <behavior name=" myBehaviour ">           <!-- To avoid disclosing metadata information, set the values below to false before deployment...

#AT Repository and Unit of Work Pattern - 6

we are going to see service file below, using ContactMang.Business.DB; using ContactMang.Business.Unit; using DTO= ContactMangDTO; public interface IUserService     {         List<DTO.LoginUser> GetAllLoginUsers();         DTO.LoginUser GetLoginUser(string userName);         DTO.LoginUser GetLoginUser(long userId);         DTO.LoginUser RegisterLoginUser(DTO.LoginUser loginUser);     } ------------------------  public class UserService:IUserService     {         private MyUnitOfWork unitOfWork = new MyUnitOfWork();         public UserService()         { }         public List<DTO.LoginUser> GetAllLoginUsers()         {             List<DTO.LoginUser> usrList=new List<DTO.LoginUser>();     ...

#AT Repository and Unit of Work Pattern - 5

UnitOfWork Layer creation Add a folder in CMBusinessTyre project Named UnitOfWorkLayer add 2 Interface and 2 class files. IMyUnitOfWork IGenericRepository MyUnitOfWork GenericRepository public interface IMyUnitOfWork    {         int Commit();    } ------------------------------------------------- public interface IGenericRepository<T>     {         IEnumerable<T> GetData();         T GetByID(object id);          T Insert(T entity);         void Delete(object id);         void Update(T entityToUpdate);         IEnumerable<T> FindBy(Expression<Func<T, bool>> predicate);         } ------------------------------------------------- public class MyUnitOfWork : IMyUnitOfWork, IDisposable     {         private Gen...

#AT Repository and Unit of Work Pattern - 4

2. DataBaseLayer Creation select solution in solution explorer->right click ->add project->new->select class library->CMBusinessTyre. Right Click CMBusinessTyre->add folder->CMDatabaseLayer Right click CMDatabaseLayer -> add new item ADO.Net Entity data model file.<CMContext> as name. ADO.Net Entity data model Wizard Select EF Designer from Database Select New connection, fill                       1. Server name                       2. Logon credentials                       3. Select Database                       4. Test connection Select Yes. include info in connection string Give connection string as u required. Eg. ContactManagerContext. Select required objects (Table. SP, View) If required change model name(optional)...

#AT Repository and Unit of Work Pattern - 3

DTO service library creation Right click on solution and add new Service Library project. Add class file for models. Eg  public class LoginUser     {         public long Id { get; set; }         public string Name { get; set; }         public string Password { get; set; }         public string Status { get; set; }     } --------------------------------------------------- public class Address     {         public long id { get; set; }         public long? ContactId { get; set; }         public string Door { get; set; }         public string Street { get; set; }         public string Place { get; set; }         public string City { get; set; }         public string Taluk { get; set; }         p...