コード例 #1
0
        /// <summary>
        /// Inicializa uma instância da classe <see cref="UfBO"/>.
        /// </summary>
        public UfBO()
            : base()
        {
            IDAOFactory daoAccess = DAOAccess.GetDAOFactory();

            ufDAO = daoAccess.UfDAO();
        }
コード例 #2
0
        /// <summary>
        /// Initializes static members of the <see cref="DAOFactoryMethod"/> class.
        /// </summary>
        static DAOFactoryMethod()
        {
            var currentDataProvider = ConfigurationManager.AppSettings["dataProvider"];

            if (string.IsNullOrWhiteSpace(currentDataProvider))
            {
                currentDAOFactory = null;
            }
            else
            {
                switch (currentDataProvider.ToLower().Trim())
                {
                case "sqlserver":
                    currentDAOFactory = new SQLServerDAOFactory();
                    break;

                case "oracle":
                    currentDAOFactory = null;
                    return;

                default:
                    currentDAOFactory = new SQLServerDAOFactory();
                    break;
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Inicializa uma instância da classe <see cref="CidadeBO"/>.
        /// </summary>
        public CidadeBO()
            : base()
        {
            IDAOFactory daoAccess = DAOAccess.GetDAOFactory();

            cidadeDAO = daoAccess.CidadeDAO();
        }
コード例 #4
0
 public ProductTagEntity(int productId, int tagId, IDAOFactory daoFactory)
 {
     this.ProductId     = productId;
     this.ProductEntity = daoFactory.ProductEntityDAO.Get(productId);
     this.TagId         = tagId;
     this.TagEntity     = daoFactory.TagEntityDAO.Get(tagId);
 }
コード例 #5
0
 /// <summary>
 /// Get the DAO factory./>.
 /// </summary>
 public static IDAOFactory GetDAOFactory()
 {
     lock (typeof(DAOAccess))
     {
         if (daoFactory == null)
         {
             UnityContainer uc = new UnityContainer();
             uc.RegisterType <IDAOFactory, DAOFactory>();
             daoFactory = uc.Resolve <DAOFactory>();
         }
         return(daoFactory);
     }
 }
コード例 #6
0
        public FolderMonitor(IDAOFactory daoFactory)
        {
            if (daoFactory == null) throw new ArgumentNullException(nameof(daoFactory));

            string directory;
            int maxDegreeOfParallelism;
            LoadSettingsFromConfig(out directory, out _directoryForProcessedFiles, out maxDegreeOfParallelism);

            _daoFactory = daoFactory;
            _watcher = new FileSystemWatcher(directory) {Filter = "*.csv"};
            _directoryNameFormat = new Regex(@"^[A-Z][a-z]{0,29}_\d{8}$");
            _cancellationTokenSource = new CancellationTokenSource();
            _scheduler = new LimitedConcurrencyLevelTaskScheduler(maxDegreeOfParallelism);
        }
コード例 #7
0
        private void InitDao()
        {
            switch (_connectionType)
            {
            case "EntityFramework":
                _daoFactory = new OrmDAOFactory();
                break;

            case "SqLiteQueries":
                break;

            default:
                break;
            }
        }
コード例 #8
0
 public ConverterFactory(IDomainFactory domainFactory,
                         IEntityFactory entityFactory,
                         IRepositoryFactory repositoryFactory,
                         IDAOFactory daoFactory)
 {
     this.domainFactory     = domainFactory;
     this.entityFactory     = entityFactory;
     this.repositoryFactory = repositoryFactory;
     this.daoFactory        = daoFactory;
     productConverter       = new ProductConverter(this.domainFactory, this.repositoryFactory);
     productEntityConverter = new ProductEntityConverter(entityFactory, daoFactory);
     stockConverter         = new StockConverter(domainFactory, repositoryFactory);
     stockEntityConverter   = new StockEntityConverter(entityFactory, daoFactory);
     tagConverter           = new TagConverter(domainFactory, repositoryFactory);
     tagEntityConverter     = new TagEntityConverter(entityFactory, daoFactory);
 }
コード例 #9
0
 static DAOFactoryMethod()
 {
     string currentDataProvider = ConfigurationManager.AppSettings["dataProvider"];
     if (String.IsNullOrWhiteSpace(currentDataProvider))
     {
         _currentDAOFactory = null;
     }
     else
     {
         switch(currentDataProvider.ToLower().Trim())
         {
             case "mysql":
                 _currentDAOFactory = new MySqlDAOFactory();
                 break;
             default:
                 _currentDAOFactory = new MySqlDAOFactory();
                 break;
         }
     }
 }
コード例 #10
0
        public ActionResult AbstractFactory(string factoryType)
        {
            IDAOFactory factory = null;

            if (factoryType == "mssql")
            {
                factory = new MsSqlFactory();
            }
            else
            {
                factory = new MySqlFactory();
            }

            factoryType = "DesignPatterns.Pattern.GangOfFour.Creational.MsSqlFactory";
            ObjectHandle oh = Activator.CreateInstance(Assembly.GetExecutingAssembly().FullName, factoryType);

            factory = (IDAOFactory)oh.Unwrap();
            DAOHelper o = new DAOHelper(factory);

            o.Save();
            return(View());
        }
コード例 #11
0
 public DAOHelper(IDAOFactory factory)
 {
     _IDAOFactory = factory;
 }
コード例 #12
0
ファイル: Factorys.cs プロジェクト: vincentvalenlee/XCRM
 public static void InitDAOFactory(IDAOFactory factory)
 {
     if (Factorys.daoFactory != null)
         throw new Exception("dao工厂只能初始化一次!");
     Factorys.daoFactory = factory;
 }
コード例 #13
0
 public ProductTagEntity CreateProductTagEntity(int productId, int tagId, IDAOFactory daoFactory)
 {
     return(new ProductTagEntity(productId, tagId, daoFactory));
 }
コード例 #14
0
ファイル: SpeedTicketQtree.cs プロジェクト: jesumarquez/lt
 public VehicleManager(IDAOFactory daoFactory)
 {
     _daoFactory = daoFactory;
 }
コード例 #15
0
 public StockEntityConverter(IEntityFactory entityFactory, IDAOFactory daoFactory)
 {
     this.entityFactory = entityFactory;
     this.daoFactory    = daoFactory;
 }
コード例 #16
0
 public ProductEntityConverter(IEntityFactory entityFactory,
                               IDAOFactory daoFactory)
 {
     this.entityFactory = entityFactory;
     this.daoFactory    = daoFactory;
 }