private static void RegisterDataTypes(IDataTypeRegistry registry, IODataObjectFactory oDataObjectFactory, IMetadataService metadataService) { // FACTON domain types with their own, complex domain values registry.Register <IUnitValueDomainType>(new UnitValueDataType(oDataObjectFactory)); registry.Register <ILocalizedLongTextDomainType>(new LocalizedTextDataType(oDataObjectFactory)); // FACTON domain types whose domain values can be mapped to CLR types registry.Register <AbstractDateTimeDomainType>(new ClrTypeReferencingDataType <DateValue, DateTimeOffset>( v => new DateTimeOffset(v.Date), v => new DateValue(v.DateTime.ToUniversalTime()))); registry.Register("Boolean", new ClrTypeReferencingDataType <BooleanValue, bool>(v => v.Value, v => v.ToBooleanValue())); registry.Register("Number", new ClrTypeReferencingDataType <NumberValue, decimal>(v => v.InternalNumber, v => new NumberValue(v))); registry.Register( new object[] { "Integer", "AutoIncrement" }, new ClrTypeReferencingDataType <IntegerValue, long>(v => v.Value, v => new IntegerValue(v))); registry.Register( new object[] { "Id", "ContextBoundId" }, new ClrTypeReferencingDataType <IId, string>(IdConverter.ConvertToString, IdConverter.ConvertToId)); registry.Register <IMetadataItemDomainType>(new MetadataItemDataType(metadataService)); // FACTON domain types whose values _are_ CLR types registry.Register("TimeSpan", ClrDataTypes.Duration); registry.Register("SimpleBoolean", ClrDataTypes.Boolean); registry.Register("SimpleInteger", ClrDataTypes.Int32); registry.Register("SimpleDecimal", ClrDataTypes.Decimal); registry.Register("SimpleLong", ClrDataTypes.Int64); registry.Register("SimpleString", ClrDataTypes.String); registry.Register("SimpleLongString", ClrDataTypes.String); // FACTON domain types whose values can be serialized/deserialized to strings, using the DomainType itself registry.Register <ILongTextDomainType, ICurrencyDomainType>(new SerializableDomainTypeDataType()); // other, non-domain types registry.Register <IId>(new ClrTypeReferencingDataType <IId, string>(IdConverter.ConvertToString, IdConverter.ConvertToId)); }
public LocalizedTextDataType(IODataObjectFactory oDataObjectFactory) { this.oDataObjectFactory = oDataObjectFactory; this.cultureValueTypeReference = CreateCultureValueTypeReference(); this.cultureValuesCollectionTypeReference = CreateCultureValuesCollectionTypeReference(this.cultureValueTypeReference); this.edmComplexType = CreateComplexType(this.cultureValuesCollectionTypeReference); }
public ODataEntityDtoBuilder(IODataObjectFactory objectFactory, IODataEntityDtoBuilderFactory dtoBuilderFactory, IEntityType entityType) { this.dtoBuilderFactory = dtoBuilderFactory; this.EntityType = entityType; this.DtoUnderConstruction = objectFactory.CreateODataEntityDto(entityType.ResultingEdmEntityType); this.DtoUnderConstruction.NavigationProperties = this.navigationProperties; this.DtoUnderConstruction.Entry.Properties = this.structuralProperties; }
public ODataEntityDtoBuilderFactory(IODataObjectFactory oDataObjectFactory) { this.oDataObjectFactory = oDataObjectFactory; }
public UnitValueDataType(IODataObjectFactory oDataObjectFactory) { this.oDataObjectFactory = oDataObjectFactory; this.edmComplexType = CreateEdmComplexType(); }