private DataProperty CreateDataProperty( string name, IType type, bool isPartOfKey, bool nullable, bool isVersion, MemberConfiguration memberConfiguration, StructuralType structuralType, ISessionFactoryImplementor sessionFactory) { var dataType = type.IsComponentType ? (DataType?)null : _dataTypeProvider.GetDataType(type); var dataProperty = CreateDataProperty( name, dataType, isPartOfKey, nullable, isVersion, memberConfiguration, structuralType, GetTypeLength(type, sessionFactory)); dataProperty.ComplexTypeName = type.IsComponentType ? GetBreezeTypeFullName(type.ReturnedClass) : null; return(dataProperty); }
public IMemberConfiguration AddMemberConfiguration() { var condition = new MemberConfiguration(); _memberConfigurations.Add(condition); return(condition); }
/// <summary> /// Configures the <see cref="JsonProperty"/> by the given <see cref="MemberConfiguration"/>. /// </summary> /// <param name="property">The property to configure.</param> /// <param name="memberConfiguration">The configuration to apply.</param> protected virtual void ConfigureProperty(JsonProperty property, MemberConfiguration memberConfiguration) { var serializePredicate = memberConfiguration.ShouldSerializePredicate; if (serializePredicate != null) // Can be the function defined in this.CreateProperty (check NHibernate initialized property) or a custom one { property.ShouldSerialize = MergePredicates(property.ShouldSerialize, serializePredicate); } var deserializePredicate = memberConfiguration.ShouldDeserializePredicate; if (deserializePredicate != null) { property.ShouldDeserialize = MergePredicates(property.ShouldDeserialize, deserializePredicate); } property.Ignored = memberConfiguration.Ignored.HasValue && memberConfiguration.Ignored.Value; property.Writable = memberConfiguration.Deserialize ?? property.Writable; property.Readable = memberConfiguration.Serialize ?? property.Readable; if (memberConfiguration.SerializeFunction != null || memberConfiguration.DeserializeFunction != null) { property.ValueProvider = new BreezeValueProvider( property.ValueProvider, memberConfiguration.MemberInfo, memberConfiguration.SerializeFunction, memberConfiguration.DeserializeFunction); } }
/// <summary> /// Creates a <see cref="JsonProperty"/> for the given <see cref="SyntheticForeignKeyProperty"/>. /// </summary> /// <param name="type">The declared type of the synthetic member.</param> /// <param name="syntheticForeignKeyProperty">The synthetic foreign key member to create a <see cref="JsonProperty"/> for.</param> /// <param name="memberConfiguration">The synthetic foreign key member configuration</param> /// <param name="associationMemberConfiguration">The association member configuration.</param> /// <returns>A created <see cref="JsonProperty"/> for the given <see cref="SyntheticForeignKeyProperty"/>.</returns> protected virtual JsonProperty CreateSyntheticForeignKeyProperty( Type type, SyntheticForeignKeyProperty syntheticForeignKeyProperty, SyntheticMemberConfiguration memberConfiguration, MemberConfiguration associationMemberConfiguration) { var property = new JsonProperty { PropertyName = ResolvePropertyName(syntheticForeignKeyProperty.Name), UnderlyingName = syntheticForeignKeyProperty.Name, PropertyType = syntheticForeignKeyProperty.IdentifierType, Ignored = memberConfiguration?.Ignored == true || associationMemberConfiguration?.Ignored == true && memberConfiguration?.Ignored == null, DeclaringType = type, Readable = memberConfiguration?.Serialize ?? associationMemberConfiguration?.Serialize ?? true, Writable = false, ValueProvider = new SyntheticForeignKeyPropertyValueProvider( syntheticForeignKeyProperty.GetAssociationFunction, syntheticForeignKeyProperty.GetIdentifierFunction, syntheticForeignKeyProperty.HasCompositeKey) }; if (memberConfiguration?.HasDefaultValue == true) { property.DefaultValue = memberConfiguration.DefaultValue; } return(property); }
private DataProperty CreateDataProperty( ClientModelProperty property, MemberConfiguration memberConfiguration, StructuralType structuralType) { var dataProperty = CreateDataProperty( property.Name, property.DataType, property.IsPartOfKey, property.IsNullable, false, memberConfiguration, structuralType, null); dataProperty.ComplexTypeName = property.IsComplexType ? GetBreezeTypeFullName(property.Type) : null; return(dataProperty); }
private DataProperty CreateDataProperty( string name, DataType?dataType, bool isPartOfKey, bool isNullable, bool isVersion, MemberConfiguration memberConfiguration, StructuralType structuralType, int?typeLength) { return(CreateDataProperty( name, dataType, isPartOfKey, memberConfiguration?.IsNullable ?? isNullable, isVersion, memberConfiguration?.HasDefaultValue == true, memberConfiguration?.DefaultValue, structuralType, memberConfiguration?.MaxLength ?? typeLength, memberConfiguration?.Custom)); }
protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly()); MemberConfiguration.Configure(modelBuilder); DocumentConfiguration.Configure(modelBuilder); }
public IMemberConfiguration AddMemberConfiguration() { var condition = new MemberConfiguration(); _memberConfigurations.Add(condition); return condition; }