当前位置: 首页>>代码示例>>C#>>正文


C# Configuration.Create方法代码示例

本文整理汇总了C#中Configuration.Create方法的典型用法代码示例。如果您正苦于以下问题:C# Configuration.Create方法的具体用法?C# Configuration.Create怎么用?C# Configuration.Create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Configuration的用法示例。


在下文中一共展示了Configuration.Create方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Load

        public override void Load()
        {
            Configuration config = new Configuration(new SqliteDatabase(m_sqliteFilename));

            config.Create<Artist>();
            config.CreateValidator();

            UnitOfWorkFactory.Initialise(config.Config, m_storage);

            Bind<Triggerfish.Validator.IValidator>()
                .To<Triggerfish.NHibernate.Validator.Validator>()
                .InRequestScope()
                .WithConstructorArgument("engine", config.Validator);

            Bind<ISession>()
                .ToMethod(x => UnitOfWorkFactory.GetCurrentSession());
            Bind<IUnitOfWorkFactory>()
                .To<UnitOfWorkFactory>()
                .InTransientScope();

            Bind<IUser>()
                .To<User>();
            Bind<IUserCredentials>()
                .To<UserCredentials>();
            Bind<IArtist>()
                .To<Artist>();
            Bind<IGenre>()
                .To<Genre>();
            Bind<IRepositorySettings>()
                .To<RepositorySettings>()
                .InRequestScope();
            Bind<IArtistsRepository>()
                .To<ArtistsRepository>()
                .InRequestScope();
            Bind<IUserRepository>()
                .To<UserRepository>()
                .InRequestScope();

            Bind<IClientSideValidation>()
                .To<xValClientSideValidation>()
                .InRequestScope();

            xVal.ActiveRuleProviders.Providers.Add(new xVal.RulesProviders.NHibernateValidator.NHibernateValidatorRulesProvider(ValidatorMode.UseAttribute));
        }
开发者ID:triggerfish,项目名称:MvcTemplate,代码行数:44,代码来源:DatabaseModule.cs

示例2: Load

        public override void Load()
        {
            Configuration config = new Configuration(new SqliteDatabase(m_sqliteFilename));

            config.Create<Transaction>();

            UnitOfWorkFactory.Initialise(config.Config, m_storage);

            // session
            Bind<ISession>()
                .ToMethod(x => UnitOfWorkFactory.GetCurrentSession());
            Bind<IUnitOfWorkFactory>()
                .To<UnitOfWorkFactory>()
                .InTransientScope();

            // entities
            Bind<Repository<Transaction>>()
                .ToSelf();

            // binders
            Bind<ModelBinder<ICgiHandler>>()
                .To<CgiHandlerBinder>();
            Bind<ICgiHandler>()
                .To<BuyNowClickHandler>()
                .Named("_xclick");
            Bind<ICgiHandler>()
                .To<AuthorisePdtHandler>()
                .Named("_notify-synch");
            Bind<ICgiHandler>()
                .To<AuthoriseIpnHandler>()
                .Named("_notify-validate");

            // misc
            Bind<IHttpRequest>()
                .To<HttpRequest>();
        }
开发者ID:triggerfish,项目名称:PayPalEmulator,代码行数:36,代码来源:StandardModule.cs

示例3: Execute

        /// <summary>
        /// Runs script on the configuration
        /// </summary>
        public void Execute(Configuration source, Configuration target)
        {
            try
               {
                    var sw = Stopwatch.StartNew();

                    if (!target.Root.Exists) target.Create();
                    if (target.Root.HasAttributes ||target.Root.HasChildren)
                        throw new ConfigException(StringConsts.CONFIGURATION_SCRIPT_TARGET_CONFIGURATION_MUST_BE_EMPTY_ERROR);

                    target.Root.Name = source.Root.Name;
                    cloneAttributes(source.Root, target.Root);
                    doNode(sw, source.Root, target.Root);
               }
               catch(Exception error)
               {
                    throw new ConfigException(StringConsts.CONFIGURATION_SCRIPT_EXECUTION_ERROR + error.ToMessageWithType(), error);
               }
        }
开发者ID:itadapter,项目名称:nfx,代码行数:22,代码来源:ScriptRunner.cs

示例4: GenerateScript

 public void GenerateScript(System.Action<string> scriptAction, IList<string> parameterValues)
 {
     Configuration config = new Configuration(new SqliteDatabase(parameterValues[0]));
     config.Create<Transaction>();
     ExportSchema.FromConfiguration(config, scriptAction);
 }
开发者ID:triggerfish,项目名称:PayPalEmulator,代码行数:6,代码来源:SqliteSchemaExporter.cs


注:本文中的Configuration.Create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。