/// <summary> /// Преобразовывает прикладной объект в объект xml-модели, используя указанный маппер. /// </summary> /// <param name="appObject"></param> /// <returns></returns> private IEnumerable <ISync> GetXMLObjectByMapper <TItem>(DataObject appObject) where TItem : IChangedItem { IEnumerable <ISync> xmlObjects; SyncSetting setting = null; IPropertyMapper mapper = null; try { // Преобразуем вычитанный изменнённый объект в его xml-представление. //TODO Проверить обработку мастеровых и детейловых объектов при маппинге. В маппинге используется дочитка, возможно сброситься состояние полученное при откате изменений. var field = GetXMLDestinationTypeByChangedItem <TItem>(appObject); // Этот объект так же должен поддерживать ISync. var syncObj = appObject as ISync; setting = SettingService.Current.GetSettings(syncObj).First(s => s.Destination.Name == field.FullName); mapper = setting.ExtractMapper <IPropertyMapper>(); xmlObjects = mapper.Map(appObject).Cast <ISync>(); } catch (ArgumentException ex) { throw; } catch (Exception ex) { throw new MappingException(appObject, setting, mapper, ex.Message); } return(xmlObjects); }
public ExplorerModel( IADRepositoryFactory factory, IGroupMapper groupMapper, IUserMapper userMapper, IPropertyMapper propertyMapper) { if (factory == null) { throw new ArgumentNullException("factory"); } if (groupMapper == null) { throw new ArgumentNullException("groupMapper"); } if (userMapper == null) { throw new ArgumentNullException("userMapper"); } if (propertyMapper == null) { throw new ArgumentNullException("propertyMapper"); } this.factory = factory; this.groupMapper = groupMapper; this.userMapper = userMapper; this.propertyMapper = propertyMapper; this.groupTask = Task.Factory.StartNew(() => { }); this.userTask = Task.Factory.StartNew(() => { }); Groups = new ThreadSafeObservableCollection <GroupModel>(); Groups.EnableSync(); Users = new ThreadSafeObservableCollection <UserModel>(); Users.EnableSync(); }
public BuildMapper(IBuildConfigurationMapper buildConfigurationMapper, IBuildChangeMapper buildChangeMapper, IPropertyMapper propertyMapper, IAgentMapper agentMapper, IBuildStatusMapper buildStatusMapper) { if (buildConfigurationMapper == null) { throw new ArgumentNullException(nameof(buildConfigurationMapper)); } if (buildChangeMapper == null) { throw new ArgumentNullException(nameof(buildChangeMapper)); } if (propertyMapper == null) { throw new ArgumentNullException(nameof(propertyMapper)); } if (agentMapper == null) { throw new ArgumentNullException(nameof(agentMapper)); } if (buildStatusMapper == null) { throw new ArgumentNullException(nameof(buildStatusMapper)); } _buildConfigurationMapper = buildConfigurationMapper; _buildChangeMapper = buildChangeMapper; _propertyMapper = propertyMapper; _agentMapper = agentMapper; _buildStatusMapper = buildStatusMapper; }
private void OnBeforeMapProperty(IModelInspector modelinspector, PropertyPath member, IPropertyMapper propertycustomizer) { if(member.LocalMember.Name == "Name") { propertycustomizer.Unique(true); } }
public ContentTypeMapper(IPropertyMapper propertyMapper, IComposerTranformationOptions options, ContentTypeNameValidator contentTypeNameValidator, MemberNameValidator memberNameValidator) { _propertyMapper = propertyMapper; _options = options ?? ComposerMigrationOptions.Default; _contentTypeNameValidator = contentTypeNameValidator; _memberNameValidator = memberNameValidator; }
public static void MapStringLengthFromAttribute(IModelInspector modelinspector, PropertyPath member, IPropertyMapper propertycustomizer) { var propertyInfo = member.LocalMember as PropertyInfo; if (propertyInfo == null || propertyInfo.PropertyType != typeof(string)) { return; } var attributes = propertyInfo.GetCustomAttributes(true); var attribute = attributes.FirstOrDefault(x => x.GetType().Name.IndexOf("Length") > -1); if (attribute == null) { return; } int value = 0; var possiblePropertyNames = new[] { "MaximumLength", "Length", "Max", "MaxLength" }; foreach (var name in possiblePropertyNames) { var attributeProperty = attribute.GetType().GetProperty(name); if (attributeProperty != null) { value = (int)attributeProperty.GetValue(attribute, null); break; } } if (value == 0) { throw new InvalidOperationException( string.Format("could not get the length of property {0}", propertyInfo.Name)); } propertycustomizer.Length(value); }
public PropertyMapperTestHelper(IPropertyMapper mapper, Action <MapperTestNode> prepareNode, string propertyName) { this.mapper = mapper; this.prepareNode = prepareNode; this.propertyName = propertyName; result = new MapperTestItem(); }
public static IPropertyToStateBinder <TInterface, TState, TArg> For <TInterface, TState, TArg>( this IPropertyMapper <TInterface, TState> mapper, Expression <Func <TInterface, TArg> > interfacePropertySelector) { //TODO: refactor return(new PropertyToStateBinder <TInterface, TState, TArg>((PropertyMapper <TInterface, TState>)mapper, interfacePropertySelector.PropertyFromGetter())); }
public PropertyMapperTestHelper(IPropertyMapper mapper, Action<MapperTestNode> prepareNode, string propertyName) { this.mapper = mapper; this.prepareNode = prepareNode; this.propertyName = propertyName; result = new MapperTestItem(); }
private void OnBeforeMapProperty(IModelInspector mi, PropertyPath member, IPropertyMapper map) { var type = member.LocalMember.GetPropertyOrFieldType(); if (type == typeof(string)) { if (member.LocalMember.Name == "FileName") { map.Length(255); } else { map.Type <DefaultStringType>(); map.Length(50); } } else if (type == typeof(byte[])) { map.Length(Int32.MaxValue / 2); map.Column(x => x.SqlType("varbinary(max)")); } if (member.LocalMember.Name == "DateCreated") { map.Update(false); } }
private static void PropertyConvension(IModelInspector modelInspector, PropertyPath propertyPath, IPropertyMapper propertyMapper) { if (modelInspector.IsSet(propertyPath.LocalMember)) { propertyMapper.Access(Accessor.Field); } var type = propertyPath.LocalMember.GetPropertyOrFieldType(); if (!type.IsNullable()) { propertyMapper.NotNullable(true); } var propertyName = propertyPath.LocalMember.Name; if (modelInspector.IsComponent(propertyPath.LocalMember.ReflectedType)) { var entityName = propertyPath.LocalMember.ReflectedType.Name; propertyMapper.Column(IdentityBuilder.BuildColumnName(entityName, propertyName)); } else { propertyMapper.Column(IdentityBuilder.BuildColumnName(propertyName)); } }
public static void initClass(TestContext testContext) { var mapping = new Mapping <Trillian, Marvin>() .map("A", "A") .map("B", "B") .map("C", "C") .map("E", "E"); _mapper = new PropertyMapperFactory() .createPropertyMapper(mapping); var mapping2 = new Mapping <Trillian, Trillian2>() .map("A") .map("B") .map("C") .map("E"); _mapperNoConversionNeeded = new PropertyMapperFactory().createPropertyMapper(mapping2); var mapping3 = new Mapping <Trillian, IDictionary <string, object> >() .map("A", (source, target, value) => { target["A"] = value; }) .map("B", (source, target, value) => { target["B"] = value; }) .map("C", (source, target, value) => { target["C"] = value; }) .map("E", (source, target, value) => { target["D"] = value; }); _mapperPropertyToSetter = new PropertyMapperFactory().createPropertyMapper(mapping3); var mapping4 = new Mapping <IDictionary <string, object>, Trillian>() .map((source, target) => source["A"], "A") .map((source, target) => source["B"], "B") .map((source, target) => source["C"], "C") .map((source, target) => source["E"], "E"); _mapperGetterToProperty = new PropertyMapperFactory().createPropertyMapper(mapping4); }
internal VisualElementRenderer(IPropertyMapper mapper, CommandMapper?commandMapper = null) #endif #if ANDROID : base(context) #elif IOS : base(CoreGraphics.CGRect.Empty)
// 6.0 TODO: Move to IPropertyMapper public static void FetchGroup(this IPropertyMapper mapper, string name) { if (mapper is PropertyMapper property) { property.FetchGroup(name); } }
/// <summary> /// Получить настройки из SyncDOEntity. /// </summary> /// <param name="syncEntity">SyncDOEntity из которой будем получать настройки</param> /// <param name="type">Тип объекта, который был изменён.</param> /// <param name="mapper">Маппер для объекта, который был изменён.</param> /// <param name="appObjPrimaryKey">Первичный ключ прикладного объекта, который был изменён.</param> private void GetSyncSettings(SyncDOEntity syncEntity, out Type type, out IPropertyMapper mapper, out Guid appObjPrimaryKey) { SyncSetting setting = null; type = null; mapper = null; if (syncEntity.ObjectPrimaryKey == null || !syncEntity.Date.HasValue || !syncEntity.AuditChangePK.HasValue) { throw new NullParamInSyncEntityException(syncEntity); } appObjPrimaryKey = syncEntity.ObjectPrimaryKey.Value; try { setting = SettingService.Current.GetSetting(syncEntity); type = setting.Source.ExtractType(); mapper = setting.ExtractMapper <IPropertyMapper>(); } catch (Exception ex) { throw new LoadSyncSettingException(syncEntity.ObjectPrimaryKey, setting, type, mapper, ex.Message); } }
void ApplyPropertyConvention(IModelInspector mi, PropertyPath type, IPropertyMapper map) { if (type.PreviousPath != null) { if (mi.IsComponent(((PropertyInfo)type.PreviousPath.LocalMember).PropertyType)) { map.Column(type.PreviousPath.LocalMember.Name + type.LocalMember.Name); } } if (type.LocalMember.GetCustomAttributes(typeof(UniqueAttribute), false).Any()) { map.Unique(true); } var propertyInfo = type.LocalMember as PropertyInfo; if (propertyInfo != null) { if (propertyInfo.PropertyType == typeof(byte[])) { map.Length(Int32.MaxValue); } return; } var fieldInfo = type.LocalMember as FieldInfo; if (fieldInfo != null && fieldInfo.FieldType == typeof(byte[])) { map.Length(Int32.MaxValue); } }
private void parseLikeCall(MethodCallExpression e, CompareOpration co, IDbTranslator dbTranslator, StringBuilder sBuilder, DataParameterCollection dpc) { ColumnFunction function; MemberExpression member; if (e.Arguments.Count == 1) { IPropertyMapper propertyMapper = this.getPropertyMapper(e.Object, out function, out member); object value = this.getValue(e.Arguments[0]); if (value != null && value is string) { this.buildSqlAndDataParameter(propertyMapper, function, co, value, dbTranslator, sBuilder, dpc); } else { throw new MapleException("'Like' clause only supported one Parameter and the Parameter should be string and not allow NULL.!"); } } //else if (e.Arguments.Count == 2) //{ // throw new MapleException("'Like' clause only supported one Parameter and the Parameter should be string and not allow NULL.!"); //} else { throw new MapleException("'Like' clause only supported one Parameter and the Parameter should be string and not allow NULL.!"); } }
protected ElementHandler(IPropertyMapper mapper, CommandMapper?commandMapper = null) { _ = mapper ?? throw new ArgumentNullException(nameof(mapper)); _defaultMapper = mapper; _mapper = _defaultMapper; _commandMapper = commandMapper; }
private void Name(IPropertyMapper propertyMapper) { propertyMapper.Column("Name"); propertyMapper.Type(NHibernateUtil.String); propertyMapper.Length(100); propertyMapper.NotNullable(false); }
public ControllerClient(IClient client, IObjectClient objectClient, IPropertyMapper propertyFactory, string controllerUri) { Client = client; ObjectClient = objectClient; PropertyFactory = propertyFactory; ControllerUri = controllerUri; }
public void AddToManyNotOwningRelation(String fromPropertyName, String mappedByPropertyName, String toEntityName, IIdMapper idMapper, IPropertyMapper fakeBidirectionalRelationMapper, IPropertyMapper fakeBidirectionalRelationIndexMapper) { relations.Add(fromPropertyName, new RelationDescription(fromPropertyName, RelationType.TO_MANY_NOT_OWNING, toEntityName, mappedByPropertyName, idMapper, fakeBidirectionalRelationMapper, fakeBidirectionalRelationIndexMapper, true)); }
private void parseNull(MethodCallExpression e, bool isNull, IDbTranslator dbTranslator, StringBuilder sBuilder, DataParameterCollection dpc) { IPropertyMapper propertyMapper = this.getPropertyMapper(e.Arguments[0], out _, out _); CompareOpration co = isNull ? CompareOpration.Equal : CompareOpration.NotEqual; this.buildSqlAndDataParameter(propertyMapper, ColumnFunction.None, co, null, dbTranslator, sBuilder, dpc); }
public ArtifactDependencyMapper(IPropertyMapper propertyMapper) { if (propertyMapper == null) { throw new ArgumentNullException("propertyMapper"); } _propertyMapper = propertyMapper; }
public AgentRequirementMapper(IPropertyMapper propertyMapper) { if (propertyMapper == null) { throw new ArgumentNullException(nameof(propertyMapper)); } _propertyMapper = propertyMapper; }
public SnapshotDependencyMapper(IPropertyMapper propertyMapper) { if (propertyMapper == null) { throw new ArgumentNullException(nameof(propertyMapper)); } _propertyMapper = propertyMapper; }
public static void MapStringAsVarchar(IModelInspector modelInspector, PropertyPath member, IPropertyMapper propertyCustomizer) { var propertyInfo = member.LocalMember as PropertyInfo; if (propertyInfo != null && propertyInfo.PropertyType == typeof(string)) { propertyCustomizer.Type(NHibernateUtil.AnsiString); } }
public void AddToManyNotOwningRelation(string fromPropertyName, string mappedByPropertyName, string toEntityName, IIdMapper idMapper, IPropertyMapper fakeBidirectionalRelationMapper, IPropertyMapper fakeBidirectionalRelationIndexMapper) { relations.Add(fromPropertyName, RelationDescription.ToMany(fromPropertyName, RelationType.ToManyNotOwning, toEntityName, mappedByPropertyName, idMapper, fakeBidirectionalRelationMapper, fakeBidirectionalRelationIndexMapper, true)); }
public TableReader(IRowReader rowReader, ITypeConverterResolver typeConverterResolver, IPropertyMapper propertyMapper, IModelValidator modelValidator) { RowReader = rowReader; TypeConverterResolver = typeConverterResolver; PropertyMapper = propertyMapper; ModelValidator = modelValidator; }
private static void callGenericTypeMethod(IPropertyMapper map, PropertyInfo property) { var enumStringOfPropertyType = typeof(EnumStringType <>).MakeGenericType(property.PropertyType); var method = map.GetType().GetMethods().First(x => x.Name == "Type" && !x.GetParameters().Any()); var genericMethod = method.MakeGenericMethod(new[] { enumStringOfPropertyType }); genericMethod.Invoke(map, null); }
/// <summary> /// Builds the dictionary of properties in this container keyed by the property name. /// </summary> /// <returns>The dictionary of properties in this container keyed by the property name.</returns> public Dictionary <string, object> ToDictionary(IPropertyMapper propertyMapper, bool includeAutoSelected = true) { Contract.Assert(propertyMapper != null); Dictionary <string, object> result = new Dictionary <string, object>(); ToDictionaryCore(result, propertyMapper, includeAutoSelected); return(result); }
public BuildTriggerMapper(IPropertyMapper propertyMapper) { if (propertyMapper == null) { throw new ArgumentNullException(nameof(propertyMapper)); } _propertyMapper = propertyMapper; }
public TableWriter <TModel> CreateWriter <TModel>(IRowWriter rowWriter, ITypeConverterResolver typeConverterResolver = null, IPropertyMapper propertyMapper = null) { typeConverterResolver = typeConverterResolver ?? new DefaultTypeConverterResolver <TModel>(); propertyMapper = propertyMapper ?? new AutoIndexPropertyMapper(); return(new TableWriter <TModel>(rowWriter, typeConverterResolver, propertyMapper)); }
public static RelationDescription ToOne(string fromPropertyName, RelationType relationType, string toEntityName, string mappedByPropertyName, IIdMapper idMapper, IPropertyMapper fakeBidirectionalRelationMapper, IPropertyMapper fakeBidirectionalRelationIndexMapper, bool insertable, bool ignoreNotFound) { return(new RelationDescription(fromPropertyName, relationType, toEntityName, mappedByPropertyName, idMapper, fakeBidirectionalRelationMapper, fakeBidirectionalRelationIndexMapper, insertable, ignoreNotFound)); }
/// <summary> /// Applies the <see cref="DateTimeOffsetSplitType"/> Composite user type to all <see cref="DateTimeOffset"/> fields in the mapping. /// </summary> /// <remarks> /// Allows the use of <see cref="DateTimeOffset"/> type with databases that do not natively support it. /// User: mapper.BeforeMapProperty += ModelMapperHelper.ApplyDateTimeOffsetSplitTypeToDateTimeOffset /// </remarks> public static void ApplyDateTimeOffsetSplitTypeToDateTimeOffset(IModelInspector inspector, PropertyPath property, IPropertyMapper mapper) { Type propertyType = property.LocalMember.GetPropertyOrFieldType(); if (propertyType == typeof(DateTimeOffset) || propertyType == typeof(DateTimeOffset?)) { mapper.Type(typeof(DateTimeOffsetSplitType), null); string columName = property.ToColumnName(); mapper.Columns(n => n.Name(columName + "DateTime"), n => n.Name(columName + "Offset")); } }
/// <summary> /// Specify a method to be run before an existing property mapping. /// </summary> /// <typeparam name="TVirtualView">The cross-platform type.</typeparam> /// <typeparam name="TViewHandler">The handler type.</typeparam> /// <param name="propertyMapper">The property mapper in which to change the mapping.</param> /// <param name="key">The name of the property.</param> /// <param name="method">The method to call before the existing mapping begins.</param> public static void PrependToMapping <TVirtualView, TViewHandler>(this IPropertyMapper <TVirtualView, TViewHandler> propertyMapper, string key, Action <TViewHandler, TVirtualView> method) where TVirtualView : IElement where TViewHandler : IElementHandler { propertyMapper.ModifyMapping(key, (handler, view, action) => { method(handler, view); action?.Invoke(handler, view); }); }
private static void MapEnumAsString(IModelInspector modelInspector, PropertyPath member, IPropertyMapper propertyCustomizer) { var propertyType = member.LocalMember.GetPropertyOrFieldType(); if (propertyType.IsEnumOrNullableEnum() == false) return; var enumType = propertyType.IsEnum ? propertyType : propertyType.GetGenericArguments().Single(); var type = typeof(EnumStringType<>).MakeGenericType(enumType); propertyCustomizer.Type(type, null); }
public RelationDescription(String fromPropertyName, RelationType relationType, String toEntityName, String mappedByPropertyName, IIdMapper idMapper, IPropertyMapper fakeBidirectionalRelationMapper, IPropertyMapper fakeBidirectionalRelationIndexMapper, bool insertable) { this.FromPropertyName = fromPropertyName; this.RelationType = relationType; this.ToEntityName = toEntityName; this.MappedByPropertyName = mappedByPropertyName; this.IdMapper = idMapper; this.FakeBidirectionalRelationMapper = fakeBidirectionalRelationMapper; this.FakeBidirectionalRelationIndexMapper = fakeBidirectionalRelationIndexMapper; this.Insertable = insertable; this.Bidirectional = false; }
protected virtual void OnBeforeMapProperty(IModelInspector modelInspector, PropertyPath member, IPropertyMapper propertyCustomizer) { }
protected override void OnBeforeMapProperty(IModelInspector modelInspector, PropertyPath member, IPropertyMapper propertyCustomizer) { Type reflectedType = member.LocalMember.ReflectedType; if (reflectedType == null) { return; } propertyCustomizer.Column(GetColumnName(modelInspector, member)); bool required = member.LocalMember .GetCustomAttributes() .OfType<RequiredAttribute>() .Any(); // Getting tableType of reflected object Type memberType = member.MemberType(); bool notNullable = required || (memberType != null && memberType.IsPrimitive) || memberType == typeof(DateTime); propertyCustomizer.NotNullable(notNullable); StringLengthAttribute stringLengthAttribute = member.LocalMember .GetCustomAttributes() .OfType<StringLengthAttribute>() .FirstOrDefault(); if (stringLengthAttribute != null) { if (stringLengthAttribute.MaximumLength > 0) { propertyCustomizer.Length(stringLengthAttribute.MaximumLength); } else { propertyCustomizer.Type(NHibernateUtil.StringClob); } } }
public void AddComposite(PropertyData propertyData, IPropertyMapper propertyMapper) { _delegate.AddComposite(propertyData, propertyMapper); }
static ObjectMappingSettings() { var pipe = new ShouldIgnorePropertyMapper(); pipe.SetNext(new AttributePropertyMapper()) .SetNext(new MapMultiUrlPickerPropertyMapper()) .SetNext(new MapUrlPickerPropertyMapper()) .SetNext(new MapMultiNodePropertyMapper()) .SetNext(new ContentPickerUrlPropertyMapper()) .SetNext(new MediaPickerPropertyMapper()) .SetNext(new ChildrenPropertyMapper()) .SetNext(new SpecialCasePropertyMapper()) .SetNext(new DefaultPropertyMapper()); defaultMap = pipe; }
private static void PrefixColumnWithComponentPropertyName(IModelInspector modelInspector, PropertyPath member, IPropertyMapper propertyCustomizer) { if (member.PreviousPath == null) return; propertyCustomizer.Column(member.ToColumnName()); }
private void TryMapComponent(IModelInspector modelInspector, PropertyPath member, IPropertyMapper propertyCustomizer) { if (modelInspector.IsComponent(member.LocalMember.DeclaringType) && !modelInspector.IsPersistentId(member.PreviousPath.LocalMember)) { propertyCustomizer.Column(member.PreviousPath.LocalMember.Name + "_" + member.LocalMember.Name); } }
public void AddComposite(PropertyData propertyData, IPropertyMapper propertyMapper) { Properties.Add(propertyData, propertyMapper); PropertyDatas.Add(propertyData.Name, propertyData); }
/// <summary> /// Initializes a new instance of the <see cref="CachedPropertyMapper"/> class. /// </summary> /// <param name="propertyMapper"> /// The <see cref="IPropertyMapper"/> being decorated. /// </param> public CachedPropertyMapper(IPropertyMapper propertyMapper) { this.propertyMapper = propertyMapper; }
public override void ToDictionaryCore(Dictionary<string, object> dictionary, IPropertyMapper mapper, bool includeAutoSelected) { foreach (var kvp in Properties) { dictionary.Add(kvp.Key, kvp.Value); } }
//public PropertyFactory(IPropertyMapper propertyMapper) public PropertyFactory() { //_propertyMapper = propertyMapper; _propertyMapper = new PropertyMapper(); }
/// <summary> /// Initializes a new instance of the <see cref="KeyDelegateBuilder"/> class. /// </summary> /// <param name="propertyMapper">The <see cref="IPropertyMapper"/> responsible for mapping fields/columns to properties.</param> /// <param name="keyInstanceEmitter">The <see cref="IMapperDelegateBuilder{T}"/> that is responsible for emitting a method that /// populates a <see cref="IStructuralEquatable"/> with key values.</param> public KeyDelegateBuilder(IPropertyMapper propertyMapper, IMapperDelegateBuilder<IStructuralEquatable> keyInstanceEmitter) { this.propertyMapper = propertyMapper; this.keyInstanceEmitter = keyInstanceEmitter; }
/// <summary> /// Sets the mapper to use: /// 1) a properties StringLength attribute if it has one for the databases field size. /// 2) non-nullable types to be not nullable in the database. /// 3) creates indexes based on the index attributes of properties. /// </summary> private void OnMapperOnBeforeMapProperty(IModelInspector inspector, PropertyPath member, IPropertyMapper customizer) { // Get all the custom attributes. var customAttributes = member.LocalMember.GetCustomAttributes(false); // For all types check for index attributes and add indexes if required. var indexAttributes = customAttributes.OfType<IndexAttribute>(); foreach (var indexAttribute in indexAttributes) { string indexPrefix = member.GetContainerEntity(inspector).Name; if (indexAttribute.Unique) { string indexName = string.Format("UI_{0}_{1}", indexPrefix, indexAttribute.Name); customizer.UniqueKey(indexName); } else { string indexName = string.Format("IX_{0}_{1}", indexPrefix, indexAttribute.Name); customizer.Index(indexName); } } // For string types check for string length attribute and set field length if required Type memberType = member.LocalMember.GetPropertyOrFieldType(); if (memberType == typeof(string)) { StringLengthAttribute stringlengthAttribute = (StringLengthAttribute)customAttributes.FirstOrDefault(x => x.GetType() == typeof(StringLengthAttribute)); int length = DefaltStringLength; if (stringlengthAttribute != null && stringlengthAttribute.MaximumLength > 0) { length = stringlengthAttribute.MaximumLength; } customizer.Length(length); } // For all types if the type is not nullable then set not nullable to true. if (!IsNullable(memberType)) { customizer.NotNullable(true); } }
private static void SetNotNullable(IModelInspector modelInspector, PropertyPath member, IPropertyMapper propertyCustomizer) { propertyCustomizer.NotNullable(member.IsNotNullable()); }
private void ApplyPropertyAttributeMappings(IModelInspector modelInspector, PropertyPath member, IPropertyMapper propertyCustomizer) { var context = new MappingContext(modelInspector, Conventions); foreach (Attribute attr in member.LocalMember.GetCustomAttributes(false)) { foreach (var mapper in _attributeMapperFactory.GetPropertyAttributeMappers(attr)) { mapper.ApplyMapping(attr, member, propertyCustomizer, context); } } }
/// <summary> /// Initializes a new instance of the <see cref="OrdinalSelector"/> class. /// </summary> /// <param name="propertyMapper">The <see cref="IPropertyMapper"/> that is responsible for mapping fields/columns from an <see cref="IDataRecord"/> to /// the properties of a <see cref="Type"/>.</param> public OrdinalSelector(IPropertyMapper propertyMapper) { this.propertyMapper = propertyMapper; }
/// <summary> /// Maps a property according the naming conventions configuration /// </summary> /// <param name="modelInspector">The model inspector</param> /// <param name="property">The property</param> /// <param name="mapper">The property mapper</param> private void MapProperty(IModelInspector modelInspector, PropertyPath property, IPropertyMapper mapper) { if (MatchOneToOneComponent(property, modelInspector)) { mapper.Column(this.namingEngine.ToComponentColumnName(property.LocalMember, property.PreviousPath.LocalMember)); } else { mapper.Column(this.namingEngine.ToColumnName(property.LocalMember)); } }
public void AddComposite(PropertyData propertyData, IPropertyMapper propertyMapper) { main.AddComposite(propertyData, propertyMapper); }