本文整理汇总了C#中MappingInfo类的典型用法代码示例。如果您正苦于以下问题:C# MappingInfo类的具体用法?C# MappingInfo怎么用?C# MappingInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MappingInfo类属于命名空间,在下文中一共展示了MappingInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FluentFor
/// <summary>
/// 인자에 맞는 <see cref="UnitOfWorkTestContext"/>의 인스턴스를 빌드한다.
/// </summary>
/// <param name="containerConfigPath">IoC 환경설정 파일경로</param>
/// <param name="dbStrategy">테스트용 DB 생성 전략</param>
/// <param name="mappingInfo">NHibernate용 Entity 정보</param>
/// <returns>테스트용 UnitOfWork</returns>
/// <param name="configAction">추가 환경설정 작업용 델리게이트</param>
/// <param name="conventions">명명규칙</param>
public static UnitOfWorkTestContext FluentFor(string containerConfigPath,
UnitOfWorkTestContextDbStrategy dbStrategy,
MappingInfo mappingInfo,
Action<NHibernate.Cfg.Configuration> configAction,
params IConvention[] conventions) {
return new FluentNHUnitOfWorkTestContext(dbStrategy, containerConfigPath, mappingInfo, configAction, conventions);
}
示例2: ARUnitOfWorkTestContext
public ARUnitOfWorkTestContext(
UnitOfWorkTestContextDbStrategy dbStrategy,
string rhinoContainerConfigPath,
MappingInfo assemblies)
: base(dbStrategy, rhinoContainerConfigPath, assemblies)
{
}
示例3: CreateFolder
public static bool CreateFolder(MappingInfo mapping, string title, string tcmContainer)
{
if (!EnsureValidClient(mapping))
return false;
try
{
FolderData folderData = new FolderData
{
Title = title,
LocationInfo = new LocationInfo { OrganizationalItem = new LinkToOrganizationalItemData { IdRef = tcmContainer } },
Id = "tcm:0-0-0"
};
folderData = Client.Save(folderData, new ReadOptions()) as FolderData;
if (folderData == null)
return false;
return true;
}
catch (Exception)
{
return false;
}
}
示例4: For
/// <summary>
/// 인자에 맞는 <see cref="UnitOfWorkTestContext"/>의 인스턴스를 빌드한다.
/// </summary>
/// <param name="container">Container</param>
/// <param name="dbStrategy">테스트용 DB 생성 전략</param>
/// <param name="mappingInfo">NHibernate용 Entity 정보</param>
/// <param name="configAction">추가 환경설정 작업용 델리게이트</param>
/// <returns>테스트용 UnitOfWork</returns>
public static UnitOfWorkTestContext For(IWindsorContainer container,
UnitOfWorkTestContextDbStrategy dbStrategy,
MappingInfo mappingInfo,
Action<NHibernate.Cfg.Configuration> configAction) {
var context = For(string.Empty, dbStrategy, mappingInfo, configAction);
context._container = container;
return context;
}
示例5: FluentNHUnitOfWorkTestContext
public FluentNHUnitOfWorkTestContext(UnitOfWorkTestContextDbStrategy dbStrategy,
string windsorConfigPath,
MappingInfo mappingInfo,
Action<Configuration> configAction,
params IConvention[] conventions)
: base(dbStrategy, windsorConfigPath, mappingInfo, configAction) {
_conventions = conventions;
}
示例6: InitializeNHibernateAndIoC
/// <summary>
/// Initialize the persistence framework, build a session factory, and
/// initialize the container. If <paramref name="rhinoContainerConfig"/>
/// is <see langword="null" /> or <see cref="string.Empty">string.Empty</see>
/// a <see cref="RhinoContainer">RhinoContainer</see> will not be initialized.
/// </summary>
/// <param name="framework">The persistence framework</param>
/// <param name="rhinoContainerConfig">The configuration file to initialize a
/// <see cref="RhinoContainer">RhinoContainer</see> or <see langword="null" />.</param>
/// <param name="databaseName">Name of the database or <see langword="null" />.</param>
/// <param name="databaseEngine">The database engine that tests should be performed against</param>
/// <param name="mappingInfo">Information used to map classes to database tables and queries.</param>
/// <remarks>
/// If <paramref name="databaseName"/> is <see langword="null" /> or
/// <see cref="string.Empty"/> a database with a name
/// derived from the other parameters supplied will be created. See
/// <see cref="NHibernateInitializer.DeriveDatabaseNameFrom(Assembly)"/> and <see cref="NHibernateInitializer.DeriveDatabaseNameFrom(DatabaseEngine, Assembly)"/>
/// </remarks>
public static void InitializeNHibernateAndIoC(PersistenceFramework framework,
string rhinoContainerConfig,
DatabaseEngine databaseEngine,
string databaseName,
MappingInfo mappingInfo)
{
NHibernateInitializer.Initialize(framework, mappingInfo).Using(databaseEngine, databaseName).AndIoC(
rhinoContainerConfig);
}
示例7: For
public static UnitOfWorkTestContext For(PersistenceFramework framwork,
IWindsorContainer container,
UnitOfWorkTestContextDbStrategy dbStrategy,
MappingInfo mappingInfo)
{
UnitOfWorkTestContext context = For(framwork, string.Empty, dbStrategy, mappingInfo);
context.rhinoContainer = container;
return context;
}
示例8: InitializeNHibernateAndIoC
/// <summary>
/// NHibernate 용 Domain을 테스트하기 위해, 환경을 초기화합니다.
/// </summary>
/// <param name="containerConfigPath">Castle Windsor configuration file path</param>
/// <param name="databaseEngine">Database 종류</param>
/// <param name="databaseName">Database name</param>
/// <param name="mappingInfo">Domain Model의 Mapping information</param>
/// <param name="configAction">configuration 부가 작업</param>
public static void InitializeNHibernateAndIoC(string containerConfigPath,
DatabaseEngine databaseEngine,
string databaseName,
MappingInfo mappingInfo,
Action<NHibernate.Cfg.Configuration> configAction) {
NHibernateInitializer.Initialize(mappingInfo, configAction)
.Using(databaseEngine, databaseName)
.AndIoC(containerConfigPath);
}
示例9: MappingStrategy
public MappingStrategy(MappingInfo mappingInfo)
{
Source = mappingInfo.MappingSourceType;
Target = mappingInfo.MappingTargetType;
HasTargetInstance = mappingInfo.MapIntoExistingTargetInstance;
ContextExpression = Expression.Parameter(typeof (MappingContext), "context");
SourceExpression = Expression.Variable(Source, "source");
TargetExpression = Expression.Variable(Target, "target");
MapperExpression = Expression.Property(ContextExpression, MappingContextMeta.Mapper);
}
示例10: BuildInsertColumns
public override StringBuilder BuildInsertColumns(MappingInfo.IObjectMapInfo map, object entity)
{
StringBuilder b = new StringBuilder();
foreach (var pmi in map.PropertyMaps)
{
b.Append(_tr.GetEscapedColumnName(pmi.ColumnName)).Append(_tr.ColumnDelimiter);
}
b.RemoveEnd(_tr.ColumnDelimiter);
return b;
}
示例11: BuildInsertValues
public override StringBuilder BuildInsertValues(MappingInfo.IObjectMapInfo map, object entity)
{
StringBuilder b = new StringBuilder();
IReflector r = Reflector.Bind(entity);
foreach (var pmi in map.PropertyMaps)
{
if (map.PrimaryKeyGenerate == PrimaryKeyGenerate.Customized && map.PrimaryKeyMaps.Contains(pmi))
{
string sequenceName = map.PKGenerateString.RemoveBegin(ConstantString.SEQ_Prefix);
b.Append(sequenceName).Append(_tr.MemberAccess).Append(ConstantString.SEQ_NextVal).Append(_tr.ColumnDelimiter);
continue;
}
b.Append(_tr.GetValueString(r.GetPropertyValue(pmi.PropertyName))).Append(_tr.ColumnDelimiter);
}
b.RemoveEnd(_tr.ColumnDelimiter);
return b;
}
示例12: MappingStrategy
public MappingStrategy(MappingInfo mappingInfo, IMappingDescriptor descriptor)
{
Descriptor = descriptor;
Source = mappingInfo.MappingSourceType;
Target = mappingInfo.MappingTargetType;
HasTargetInstance = mappingInfo.MapIntoExistingTargetInstance;
try
{
TargetConstructor = Target.GetConstructors().Single();
ConstructorParameterMappingSteps = new OrderedKeyedCollection<ParameterInfo, MappingStep>(TargetConstructor.GetParameters());
}
catch (InvalidOperationException)
{
throw new ArgumentException("Target type must have single public constructor. This is the only scenario supported at the moment.", "target");
}
ContextExpression = Expression.Parameter(typeof (MappingContext), "context");
SourceExpression = Expression.Variable(Source, "source");
TargetExpression = Expression.Variable(Target, "target");
MapperExpression = Expression.Property(ContextExpression, MappingContextMeta.Mapper);
}
示例13: BuildMappingStrategy
public MappingStrategy BuildMappingStrategy(MappingInfo mappingInfo)
{
var strategy = new MappingStrategy(mappingInfo, descriptor);
//first try to shortcircuit
var directMappingStep = new DirectMappingStep(strategy.Source, strategy.Target);
var converter = ApplyConverter(directMappingStep, withFallback: false);
if (converter != null)
{
directMappingStep.Conversion = converter;
strategy.InitTargetStep = directMappingStep;
return strategy;
}
foreach (var pattern in mappingPatterns)
{
pattern.Contribute(strategy);
}
foreach (var mappingStep in strategy.MappingSteps)
{
mappingStep.Conversion = ApplyConverter(mappingStep, withFallback: true);
}
if (strategy.HasTargetInstance)
{
strategy.InitTargetStep = new SimpleStep(strategy.Target, strategy.Target, (s, _) => Expression.Convert(Expression.Property(s.ContextExpression, MappingContextMeta.TargetInstance), s.Target));
}
else
{
foreach (var mappingStep in strategy.ConstructorParameterMappingSteps.ByKey)
{
if (mappingStep.Value == null)
{
throw new InvalidOperationException(string.Format("No mapping for constructor parameter {0} has been specified. All constructor parameters need value", mappingStep.Key));
}
mappingStep.Value.Conversion = ApplyConverter(mappingStep.Value, withFallback: true);
}
strategy.InitTargetStep = new SimpleStep(strategy.Target, strategy.Target, (s, _) => Expression.New(s.TargetConstructor, GetConstructorParameters(s)));
}
return strategy;
}
示例14: GetTcpClient
public static LocalSessionAwareCoreServiceClient GetTcpClient(MappingInfo mapping)
{
EnsureCredentialsNotEmpty(mapping);
return GetTcpClient(mapping.Host, mapping.Username, mapping.Password);
}
示例15: NHUnitOfWorkTestContext
/// <summary>
/// 생성자
/// </summary>
/// <param name="dbStrategy">테스트용 DB 생성 전략</param>
/// <param name="windsorConfigPath">IoC 환경설정 파일경로</param>
/// <param name="mappingInfo">NHibernate 매핑 정보</param>
/// <param name="configAction">Configuration 빌드 시 추가할 사항을 정의한 Action</param>
public NHUnitOfWorkTestContext(UnitOfWorkTestContextDbStrategy dbStrategy,
string windsorConfigPath,
MappingInfo mappingInfo,
Action<Configuration> configAction)
: base(dbStrategy, windsorConfigPath, mappingInfo, configAction) {}