Beispiel #1
0
 /// <summary>
 /// Constructs an instance of <see cref="ModelMetadata"/>.
 /// </summary>
 protected ModelMetadata(
     Type type,
     Type baseType,
     AutoGeneratedKeyType autoGeneratedKeyType,
     bool hasCompositeKey,
     IReadOnlyDictionary <string, SyntheticForeignKeyProperty> syntheticForeignKeyProperties,
     IReadOnlyCollection <Type> derivedTypes,
     IReadOnlyCollection <string> derivedPropertyNames,
     IReadOnlyList <string> identifierPropertyNames,
     IReadOnlyList <Func <object, object> > identifierPropertyGetters,
     IReadOnlyList <Type> identifierPropertyTypes,
     IReadOnlyList <DataType> identifierPropertyDataTypes,
     IReadOnlyList <int?> identifierPropertyTypeLengths,
     IReadOnlyCollection <string> foreignKeyPropertyNames,
     IReadOnlyDictionary <string, Association> associations)
 {
     Type                          = type;
     BaseType                      = baseType;
     AutoGeneratedKeyType          = autoGeneratedKeyType;
     HasCompositeKey               = hasCompositeKey;
     SyntheticForeignKeyProperties = syntheticForeignKeyProperties;
     DerivedTypes                  = derivedTypes;
     DerivedPropertyNames          = derivedPropertyNames;
     Associations                  = associations;
     ForeignKeyPropertyNames       = foreignKeyPropertyNames;
     IdentifierPropertyGetters     = identifierPropertyGetters;
     IdentifierPropertyTypes       = identifierPropertyTypes;
     IdentifierPropertyNames       = identifierPropertyNames;
     IdentifierPropertyDataTypes   = identifierPropertyDataTypes;
     IdentifierPropertyTypeLengths = identifierPropertyTypeLengths;
 }
 /// <summary>
 /// Constructs an instance of <see cref="EntityMetadata"/>.
 /// </summary>
 public EntityMetadata(
     AbstractEntityPersister entityPersister,
     Func <object> createInstance,
     IEntityBatchFetcher batchFetcher,
     Type type,
     Type baseType,
     AutoGeneratedKeyType autoGeneratedKeyType,
     string versionPropertyName,
     Type versionPropertyType,
     bool hasCompositeKey,
     IReadOnlyDictionary <string, SyntheticForeignKeyProperty> syntheticForeignKeyProperties,
     IReadOnlyCollection <Type> derivedTypes,
     IReadOnlyCollection <string> derivedPropertyNames,
     IReadOnlyList <string> identifierPropertyNames,
     IReadOnlyList <Func <object, object> > identifierPropertyGetters,
     IReadOnlyList <Type> identifierPropertyTypes,
     IReadOnlyList <DataType> identifierPropertyDataTypes,
     IReadOnlyList <int?> identifierPropertyTypeLengths,
     IReadOnlyCollection <string> foreignKeyPropertyNames,
     IReadOnlyDictionary <string, Association> associations,
     IReadOnlyDictionary <string, EntityAssociation> foreignKeyAssociations,
     IReadOnlyDictionary <string, Func <object, object> > manyToOneIdentifierProperties)
     : base(
         type,
         baseType,
         autoGeneratedKeyType,
         hasCompositeKey,
         syntheticForeignKeyProperties,
         derivedTypes,
         derivedPropertyNames,
         identifierPropertyNames,
         identifierPropertyGetters,
         identifierPropertyTypes,
         identifierPropertyDataTypes,
         identifierPropertyTypeLengths,
         foreignKeyPropertyNames,
         associations)
 {
     EntityPersister               = entityPersister;
     CreateInstance                = createInstance;
     BatchFetcher                  = batchFetcher;
     ForeignKeyAssociations        = foreignKeyAssociations;
     VersionPropertyName           = versionPropertyName;
     VersionPropertyType           = versionPropertyType;
     ManyToOneIdentifierProperties = manyToOneIdentifierProperties;
     AllProperties                 = new HashSet <string>(
         identifierPropertyNames
         .Concat(manyToOneIdentifierProperties.Keys) // We have to add also many-to-one identifier names as identifierPropertyNames does not contain them
         .Concat(entityPersister.PropertyNames)
         .Concat(syntheticForeignKeyProperties.Select(o => o.Key)));
 }
Beispiel #3
0
 /// <summary>
 /// Constructs an instance of <see cref="ClientModelMetadata"/>.
 /// </summary>
 public ClientModelMetadata(
     Type type,
     Type baseType,
     AutoGeneratedKeyType autoGeneratedKeyType,
     IReadOnlyList <ClientModelProperty> properties,
     IReadOnlyDictionary <string, SyntheticForeignKeyProperty> syntheticForeignKeyProperties,
     IReadOnlyCollection <Type> derivedTypes,
     IReadOnlyCollection <string> derivedPropertyNames,
     IReadOnlyList <string> identifierPropertyNames,
     IReadOnlyList <Func <object, object> > identifierPropertyGetters,
     IReadOnlyList <Type> identifierPropertyTypes,
     IReadOnlyList <DataType> identifierPropertyDataTypes,
     IReadOnlyList <int?> identifierPropertyTypeLengths,
     IReadOnlyCollection <string> foreignKeyPropertyNames,
     IReadOnlyDictionary <string, Association> associations)
     : base(
         type,
         baseType,
         autoGeneratedKeyType,
         false,
         syntheticForeignKeyProperties,
         derivedTypes,
         derivedPropertyNames,
         identifierPropertyNames,
         identifierPropertyGetters,
         identifierPropertyTypes,
         identifierPropertyDataTypes,
         identifierPropertyTypeLengths,
         foreignKeyPropertyNames,
         associations)
 {
     Properties    = properties;
     AllProperties = new HashSet <string>(identifierPropertyNames
                                          .Concat(properties.Select(o => o.Name))
                                          .Concat(syntheticForeignKeyProperties.Select(o => o.Key)));
 }
Beispiel #4
0
 public AutoGeneratedKey(Object entity, dynamic autoGeneratedKey)
 {
     Entity = entity;
       PropertyName = autoGeneratedKey.propertyName;
       AutoGeneratedKeyType = (AutoGeneratedKeyType)Enum.Parse(typeof(AutoGeneratedKeyType), (String)autoGeneratedKey.autoGeneratedKeyType);
       // TempValue and RealValue will be set later. - TempValue during Add, RealValue after save completes.
 }
 /// <inheritdoc />
 public IModelConfigurator AutoGeneratedKeyType(AutoGeneratedKeyType value)
 {
     Configuration.AutoGeneratedKeyType = value;
     return(this);
 }