Пример #1
0
        public DaoProxyRegistration(Type daoType)
        {
            Args.ThrowIfNull(daoType, "daoType");
            Args.ThrowIf <InvalidOperationException>(
                !daoType.IsSubclassOf(typeof(Dao)), "The specified type ({0}) must be a Dao implementation.",
                daoType.Name);

            this.ServiceProvider = new Incubator();
            this.Assembly        = daoType.Assembly;
            this.ContextName     = Dao.ConnectionName(daoType);
            Dao.RegisterDaoTypes(daoType, this.ServiceProvider);
        }
Пример #2
0
        public DaoProxyRegistration(Assembly assembly)
        {
            this.ServiceProvider = new Incubator();
            this.Assembly        = assembly;
            Type daoType = (from type in assembly.GetTypes()
                            where type.IsSubclassOf(typeof(Dao))
                            select type).FirstOrDefault();

            Args.ThrowIfNull(daoType, "daoType");

            this.ContextName = Dao.ConnectionName(daoType);
            Dao.RegisterDaoTypes(daoType, this.ServiceProvider);
        }