Ejemplo n.º 1
0
        /// <summary>
        /// Loop through all of the classes in the Implementation namespace and
        /// map those implementations to their associated interfaces and adds
        /// those mappings to the IoC container
        /// </summary>
        public static void ConfigureSqlRepositories()
        {
            if (_IsSqlConfigured)
            {
                return;
            }

            foreach (var type in Assembly.GetExecutingAssembly().GetTypes().Where(p => p.Namespace == "SysCEF.DAO.Implementacao"))
            {
                foreach (var iface in type.GetInterfaces().Where(p => p.Namespace == "SysCEF.DAO.Interface"))
                {
                    ObjectContainer.AddSingletonDefinition(iface, type);
                }
            }

            _IsSqlConfigured = true;
        }
Ejemplo n.º 2
0
        public static void ConfigureDependencies()
        {
            if (_IsConfigured)
            {
                return;
            }

            ObjectContainer.AddSingletonDefinition(typeof(IObjectContainer), typeof(ObjectContainer));
            ObjectContainer.AddSingletonDefinition(typeof(IUnitOfWorkFactory), typeof(UnitOfWorkFactory));
            ObjectContainer.AddPrototypeDefinition(typeof(IADOQuery), typeof(ADOQuery));
            ObjectContainer.AddPrototypeDefinition(typeof(IHQLQuery), typeof(HQLQuery));
            ObjectContainer.AddSingletonDefinition(typeof(IPersistenceBroker), typeof(PersistenceBroker));
            ObjectContainer.AddPrototypeDefinition(typeof(ISQLQuery), typeof(SQLQuery));
            ObjectContainer.AddSingletonDefinition(typeof(IUnitOfWorkFactory), typeof(UnitOfWorkFactory));

            _IsConfigured = true;
        }