本文整理汇总了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));
}
示例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>();
}
示例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);
}
}
示例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);
}