Jul 9, 2014

DI Development

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged




IntelliModules.Utils
CommonUtil.cs
namespace IntelliModules.Utils
{
    public class CommonUtil
    {
        public static void InitiateAuthenticationBootStrapper(object objectToBuildUp)
        {
            CommonBootStrapper.Restart();
            CommonBootStrapper.Configure<AuthenticationBootStrapper>();
            CommonBootStrapper.BuildUp(objectToBuildUp);
        }
    }
}
IntelliModules.CommonRegistries
CommonBootStrapper.cs
namespace IntelliModules.CommonRegistries
{
    public class CommonBootStrapper
    {
        private static bool bootCompleted;

        public virtual void Configure()
        {
            throw new NotImplementedException();
        }

        public void BootstrapperMap()
        {
            ObjectFactory.Initialize(x =>
                {
                    x.IgnoreStructureMapConfig = true;
                    x.UseDefaultStructureMapConfigFile = true;

                });
        }
        public static void Restart()
        {
            if (bootCompleted)
            {
                ObjectFactory.ResetDefaults();
            }
            else
            {
                Bootstrap();
            }

        }
        public static void Bootstrap()
        {
            new CommonBootStrapper().BootstrapperMap();
            bootCompleted = true;
        }

        public static void Configure<T>() where T : CommonBootStrapper, new()
        {
            new T().Configure();
        }

        public static void BuildUp(object objectbuildup)
        {
            ObjectFactory.BuildUp(objectbuildup);
        }

    }
}


AuthenticationRegistry.cs

namespace IntelliModules.CommonRegistries
{
   public  class AuthenticationRegistry:Registry
    {
       public  AuthenticationRegistry()
       {
           For<IEmployeeManger>().Use<EmployeeManager>();
           SetAllProperties(x=>x.OfType<IEmployeeManger>());

           For<IEmployeeDataManager>().Use<EmployeeDataManager>();
           SetAllProperties(x=>x.OfType<IEmployeeDataManager>());
       }
    }
}

AuthenticationBootStrapper.cs

namespace IntelliModules.CommonRegistries
{
    public class AuthenticationBootStrapper :CommonBootStrapper
    {
        public override void Configure()
        {
            ObjectFactory.Configure(x => x.AddRegistry<AuthenticationRegistry>());
        }
    }
}

#region Private Fields
        private IAdminDataManager m_AdminDataManager;
        #endregion

        #region Constructor
        public AdminManager(IAdminDataManager adminDataManager)
        {
            m_AdminDataManager = adminDataManager;
        }
        #endregion

        public AdminModels GetAdminUsers(string companyname)
        {
            return m_AdminDataManager.GetAdminUsers(companyname);
        }


public class AssetDataManager : IAssetDataManager
    {

        private readonly TIMPublicEntities publiccontext;
Recent Posts
Popular Articles

 

© 2013 MUNISH ORACLE DBA& .Net Developer. All rights resevered. Designed by Templateism

Back To Top