private void ApplyGenerator(IGeneratorDef generator) { var hbmGenerator = new HbmGenerator { @class = generator.Class }; if (hbmId.name == null) { // no member for the id var defaultReturnType = generator.DefaultReturnType; // where a DefaultReturnType is not available, let NH discover it during the mapping-binding process if (defaultReturnType != null) { hbmId.type1 = defaultReturnType.GetNhTypeName(); } } object generatorParameters = generator.Params; if (generatorParameters != null) { hbmGenerator.param = (from pi in generatorParameters.GetType().GetProperties() let pname = pi.Name let pvalue = pi.GetValue(generatorParameters, null) select new HbmParam { name = pname, Text = new[] { ReferenceEquals(pvalue, null) ? "null" : pvalue.ToString() } }). ToArray(); } else { hbmGenerator.param = null; } hbmId.generator = hbmGenerator; }
private void ApplyGenerator(IGeneratorDef generator) { var hbmGenerator = new HbmGenerator { @class = generator.Class }; if (hbmId.name == null) { // no member for the id hbmId.type1 = generator.DefaultReturnType.GetNhTypeName(); } object generatorParameters = generator.Params; if (generatorParameters != null) { hbmGenerator.param = (from pi in generatorParameters.GetType().GetProperties() let pname = pi.Name let pvalue = pi.GetValue(generatorParameters, null) select new HbmParam { name = pname, Text = new[] { ReferenceEquals(pvalue, null) ? "null" : pvalue.ToString() } }). ToArray(); } else { hbmGenerator.param = null; } hbmId.generator = hbmGenerator; }
private void ApplyGenerator(IGeneratorDef generator) { var hbmGenerator = new HbmGenerator {@class = generator.Class}; if(hbmId.name == null) { // no member for the id var defaultReturnType = generator.DefaultReturnType; // where a DefaultReturnType is not available, let NH discover it during the mapping-binding process if (defaultReturnType != null) { hbmId.type1 = defaultReturnType.GetNhTypeName(); } } object generatorParameters = generator.Params; if (generatorParameters != null) { hbmGenerator.param = (from pi in generatorParameters.GetType().GetProperties() let pname = pi.Name let pvalue = pi.GetValue(generatorParameters, null) select new HbmParam {name = pname, Text = new[] {ReferenceEquals(pvalue, null) ? "null" : pvalue.ToString()}}). ToArray(); } else { hbmGenerator.param = null; } hbmId.generator = hbmGenerator; }
private void ApplyGenerator(IGeneratorDef generator) { var hbmGenerator = new HbmGenerator { @class = generator.Class }; object generatorParameters = generator.Params; if (generatorParameters != null) { hbmGenerator.param = (from pi in generatorParameters.GetType().GetProperties() let pname = pi.Name let pvalue = pi.GetValue(generatorParameters, null) select new HbmParam { name = pname, Text = new[] { ReferenceEquals(pvalue, null) ? "null" : pvalue.ToString() } }). ToArray(); } else { hbmGenerator.param = null; } hbmId.generator = hbmGenerator; AutosetTypeThroughGeneratorDef(generator); }
public static Configuration AddIdentityMapping <TUser, TKey>( this Configuration configuration, IGeneratorDef generatorDef) where TKey : IEquatable <TKey> where TUser : IdentityUser <TKey> { return(configuration.AddIdentityMapping <TUser, IdentityRole <TKey>, TKey>(generatorDef)); }
private void AutosetTypeThroughGeneratorDef(IGeneratorDef generator) { if (Equals(hbmId.type, autosetType) && generator.DefaultReturnType != null) { autosetType = generator.DefaultReturnType.GetNhTypeName(); hbmId.type = autosetType; } }
public void Generator(IGeneratorDef generator, Action<IGeneratorMapper> generatorMapping) { if (generator == null) { return; } if(!generator.SupportedAsCollectionElementId) { throw new NotSupportedException("The generator '" + generator.Class + "' cannot be used as collection element id."); } ApplyGenerator(generator); generatorMapping(new GeneratorMapper(hbmId.generator)); }
public void Generator(IGeneratorDef generator, Action <IGeneratorMapper> generatorMapping) { if (generator == null) { return; } if (!generator.SupportedAsCollectionElementId) { throw new NotSupportedException("The generator '" + generator.Class + "' cannot be used as collection element id."); } ApplyGenerator(generator); generatorMapping(new GeneratorMapper(hbmId.generator)); }
public static Configuration AddIdentityMapping <TUser, TRole, TKey>( this Configuration configuration, IGeneratorDef generatorDef) where TKey : IEquatable <TKey> where TUser : IdentityUser <TKey> where TRole : IdentityRole <TKey> { var mapper = new ModelMapper(); mapper.AddMapping(new IdentityRoleMapping <TRole, TKey>(generatorDef)); mapper.AddMapping(new IdentityRoleClaimMapping <TKey>(generatorDef)); mapper.AddMapping(new IdentityUserMapping <TUser, TKey>(generatorDef)); mapper.AddMapping(new IdentityUserClaimMapping <TKey>(generatorDef)); mapper.AddMapping <IdentityUserLoginMapping <TKey> >(); mapper.AddMapping <IdentityUserRoleMapping <TKey> >(); mapper.AddMapping <IdentityUserTokenMapping <TKey> >(); configuration.AddMapping(mapper.CompileMappingForAllExplicitlyAddedEntities()); return(configuration); }
private void ApplyGenerator(IGeneratorDef generator) { var hbmGenerator = new HbmGenerator {@class = generator.Class}; if(hbmId.name == null) { // no member for the id hbmId.type1 = generator.DefaultReturnType.GetNhTypeName(); } object generatorParameters = generator.Params; if (generatorParameters != null) { hbmGenerator.param = (from pi in generatorParameters.GetType().GetProperties() let pname = pi.Name let pvalue = pi.GetValue(generatorParameters, null) select new HbmParam {name = pname, Text = new[] {ReferenceEquals(pvalue, null) ? "null" : pvalue.ToString()}}). ToArray(); } else { hbmGenerator.param = null; } hbmId.generator = hbmGenerator; }
public void Generator(IGeneratorDef generator, Action <IGeneratorMapper> generatorMapping) { ApplyGenerator(generator); generatorMapping(new GeneratorMapper(hbmId.generator)); }
public void Generator(IGeneratorDef generator) { Generator(generator, x => { }); }
public static IGeneratorDef ShardedUUIDGenerator() { return(shardedUUIDGenerator ?? (shardedUUIDGenerator = new ShardedUUIDGeneratorDef())); }
public IdentityRoleClaimMapping( IGeneratorDef generatorDef) : base(generatorDef) { }
public IdentityUserMapping( IGeneratorDef generatorDef) : base(generatorDef) { }
public IdentityUserMapping( string tableName, IGeneratorDef generatorDef) : base(tableName, generatorDef) { }
public IdentityRoleClaimMapping( string tableName, IGeneratorDef generatorDef) : base(tableName, generatorDef) { }
public void Generator(IGeneratorDef generator, Action<IGeneratorMapper> generatorMapping) { ApplyGenerator(generator); generatorMapping(new GeneratorMapper(hbmId.generator)); }
public static IGeneratorDef ShardedHighLowGenerator() { return(shardedHiLoGenerator ?? (shardedHiLoGenerator = new ShardedHighLowGeneratorDef())); }