Exemplo n.º 1
0
        public EmployeeBO(IEmployeeConverter _EmployeeConverter)
        {
            context = RepositoryHelper.GetDbContext();
            uow = RepositoryHelper.GetUnitOfWork(context);
            this.entiesrepository = RepositoryHelper.GetEmployeeRepository(context);
			this.typeAdapter = _EmployeeConverter;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="EmployeeBusinessObject"/> class.
        /// </summary>
        /// <param name="lazyloaded">if set to <c>true</c> [lazyloaded].</param>
        /// <param name="proxycreated">if set to <c>true</c> [proxycreated].</param>
        public EmployeeBusinessObject(bool lazyloaded, bool proxycreated)
        {
            this.context = RepositoryHelper.GetDbContext();

            /*  http://msdn.microsoft.com/en-us/library/dd456853.aspx
                 Windows Communication Foundation (WCF) cannot directly serialize or deserialize proxies because the DataContractSerializer
                  can only serialize and deserialize known types, and proxy types are not known types. 
                  When you need to serialize POCO entities, disable proxy creation or use the ProxyDataContractResolver class 
                  to serialize proxy objects as the original POCO entities. 
                  To disable proxy creation, set the ProxyCreationEnabled property to false.  */

            ///we have test use ProxyDataContractResolver class is not work with webHttp bind in WCF. only set them as false.
            this.context.LazyLoadingEnabled = lazyloaded;
            this.context.ProxyCreationEnabled = proxycreated;

            this.uow = RepositoryHelper.GetUnitOfWork(context);
            this.employeeRepository = RepositoryHelper.GetEmployeeRepository(context);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="EmployeeBusinessObject"/> class.
 /// </summary>
 public EmployeeBusinessObject()
 {
     this.context = RepositoryHelper.GetDbContext();
     this.uow = RepositoryHelper.GetUnitOfWork(context);
     this.employeeRepository = RepositoryHelper.GetEmployeeRepository(context);
 }