public void should_initial_cap_list_primitive_type_name() { var description = new TypeConvention().GetDescription(typeof(List <Int64>)); description.Type.ShouldEqual(typeof(Int64)); description.Name.ShouldEqual("ArrayOfLong"); }
public void should_return_name_of_inherited_list_datatype_with_collection_data_contract_attribute() { var description = new TypeConvention().GetDescription(typeof(SomeCollectionWithDataContractName)); description.Type.ShouldEqual(typeof(SomeType)); description.Name.ShouldEqual("SomeTypes"); description.Comments.ShouldBeNull(); }
public void should_return_attribute_description_of_inherited_list_datatype_with_xml_type_attribute() { var description = new TypeConvention().GetDescription(typeof(SomeMoarTypes)); description.Type.ShouldEqual(typeof(SomeType)); description.Name.ShouldEqual("SomeTypes"); description.Comments.ShouldEqual("These are some moar types."); }
public void should_return_default_description_of_list_datatype() { var description = new TypeConvention().GetDescription(typeof(List <SomeType>)); description.Type.ShouldEqual(typeof(SomeType)); description.Name.ShouldEqual("ArrayOfSomeType"); description.Comments.ShouldBeNull(); }
public void should_return_attribute_description_of_inherited_list_datatype() { var description = new TypeConvention().GetDescription(typeof(SomeTypes)); description.Type.ShouldEqual(typeof(SomeType)); description.Name.ShouldEqual("ArrayOfSomeType"); description.Comments.ShouldEqual("These are some types."); }
public TypeMapperConventions( TypeConvention <object, object> typeConvention, IKeyConvention keyConvention, IVersionConvention versionConvention) { TypeConvention = typeConvention; KeyConvention = keyConvention; VersionConvention = versionConvention; }
public void should_return_default_description_of_datatype() { var type = typeof(SomeType); var description = new TypeConvention().GetDescription(type); description.Type.ShouldEqual(type); description.Name.ShouldEqual("SomeType"); description.Comments.ShouldBeNull(); }
public TypeMapperConventions( TypeConvention<object, object> typeConvention, IKeyConvention keyConvention, IVersionConvention versionConvention) { TypeConvention = typeConvention; KeyConvention = keyConvention; VersionConvention = versionConvention; }
public void should_return_data_contract_attribute_name() { var type = typeof(SomeTypeWithDataContractName); var description = new TypeConvention().GetDescription(type); description.Type.ShouldEqual(type); description.Name.ShouldEqual("SomeType"); description.Comments.ShouldBeNull(); }
public void should_return_attribute_description_of_datatype_and_xml_root_attribute() { var type = typeof(SomeTypeWithXmlRootName); var description = new TypeConvention().GetDescription(type); description.Type.ShouldEqual(type); description.Name.ShouldEqual("SomeRoot"); description.Comments.ShouldBeNull(); }
public void should_return_attribute_description_of_datatype() { var type = typeof(SomeTypeWithComments); var description = new TypeConvention().GetDescription(type); description.Type.ShouldEqual(type); description.Name.ShouldEqual("SomeTypeWithComments"); description.Comments.ShouldEqual("This is a type with comments."); }
public ModelAnnotationsMapper( TypeConvention <object, object> typeConvention, IKeyConvention keyConvention, IVersionConvention versionConvention) { var conventions = new TypeMapperConventions(null, null, null, typeConvention, keyConvention, versionConvention); typeMapper = TypeMapperFactory.Create(conventions); }
public static TypeMapper CreateByConventions( TypeConvention <object, object> convention, IKeyConvention keyConvention, IVersionConvention versionConvention) { var typeMapperConventions = new TypeMapperConventions( convention, keyConvention, versionConvention); return (new TypeMapper(typeMapperConventions)); }
public static TypeMapper CreateByConventions( TypeConvention<object, object> convention, IKeyConvention keyConvention, IVersionConvention versionConvention) { var typeMapperConventions = new TypeMapperConventions( convention, keyConvention, versionConvention); return new TypeMapper(typeMapperConventions); }
public TypeMapperConventions( IMemberStrategy primitiveStrategy, IMemberStrategy referenceStrategy, IMemberStrategy collectionStrategy, TypeConvention <object, object> typeConvention, IKeyConvention keyConvention, IVersionConvention versionConvention) { PrimitiveStrategy = primitiveStrategy; ReferenceStrategy = referenceStrategy; CollectionStrategy = collectionStrategy; TypeConvention = typeConvention; KeyConvention = keyConvention; VersionConvention = versionConvention; }
public TypeMapperConventions( IMemberStrategy primitiveStrategy, IMemberStrategy referenceStrategy, IMemberStrategy collectionStrategy, TypeConvention<object, object> typeConvention, IKeyConvention keyConvention, IVersionConvention versionConvention) { PrimitiveStrategy = primitiveStrategy; ReferenceStrategy = referenceStrategy; CollectionStrategy = collectionStrategy; TypeConvention = typeConvention; KeyConvention = keyConvention; VersionConvention = versionConvention; }
/// <summary> /// 构造函数 /// </summary> /// <param name="entityType"></param> /// <param name="typeConvention"></param> /// <param name="modelConvention"></param> public DapperMetadata(Type entityType, TypeConvention typeConvention, ModelConvention modelConvention) { Guard.ArgumentNotNull(entityType, nameof(entityType)); EntityType = entityType; var metadatas = from prop in entityType.GetProperties(BindingFlags.Public | BindingFlags.Instance) where prop.CanRead && prop.CanWrite && CheckFieldType(prop.PropertyType) let convention = modelConvention.PropertyConventions.FirstOrDefault(x => x.Filter(prop)) select convention != null ? new DapperFieldMetadata(prop, convention) : new DapperFieldMetadata(prop); Fields = metadatas.ToList(); TableName = MappingStrategyParser.Parse(entityType.Name); if (typeConvention.Filter(entityType)) { ReadingConnectionName = typeConvention.DbReadingConnectionName; WritingConnectionName = typeConvention.DbWritingConnectionName; } }