/// <summary> /// Registers the given <paramref name="serializer"/> for the entity property, /// which is expressed in the <paramref name="propertyExpression"/> /// </summary> /// <param name="propertyExpression">Expression for entity property which will be serialized</param> /// <param name="serializer">Entity property serializer</param> public ImperativeMetamodelProvider UseSerializer <TEntity, TProperty>( Expression <Func <TEntity, TProperty> > propertyExpression, IStorageValueSerializer serializer) { if (propertyExpression == null) { throw new ArgumentNullException(nameof(propertyExpression)); } var propertyInfo = GetPropertyInfo(propertyExpression); return(UseSerializer(propertyInfo, serializer)); }
/// <summary> /// Registers the given <paramref name="serializer"/> for the given user <paramref name="type"/> /// </summary> /// <param name="type">User type which will be serialized</param> /// <param name="serializer">User type serializer</param> public ImperativeMetamodelProvider UseSerializer(Type type, IStorageValueSerializer serializer) { if (type == null) { throw new ArgumentNullException(nameof(type)); } if (serializer == null) { throw new ArgumentNullException(nameof(serializer)); } _typeSerializers = _typeSerializers.Add(type, serializer); return(this); }
/// <summary> /// Registers the given <paramref name="serializer"/> for the entity <paramref name="property"/> /// </summary> /// <param name="property">Entity property which will be serialized</param> /// <param name="serializer">Entity property serializer</param> public ImperativeMetamodelProvider UseSerializer(PropertyInfo property, IStorageValueSerializer serializer) { if (property == null) { throw new ArgumentNullException(nameof(property)); } if (serializer == null) { throw new ArgumentNullException(nameof(serializer)); } if (!typeof(AzureTableEntity).IsAssignableFrom(property.DeclaringType)) { throw new ArgumentException($"The property {property.DeclaringType}.{property.Name} should be declared in the entity type, which is descendant of the {typeof(AzureTableEntity)}"); } _propertySerializers = _propertySerializers.Add(property, serializer); return(this); }
public SerializerStorageValueConverter(IStorageValueSerializer serializer, Type propertyType) { _serializer = serializer; _propertyType = propertyType; }
/// <summary> /// Registers the given <paramref name="serializer"/> for the given user type <typeparamref name="T"/> /// </summary> /// <typeparam name="T">User type which will be serialized</typeparam> /// <param name="serializer">User type serializer</param> public ImperativeMetamodelProvider UseSerializer <T>(IStorageValueSerializer serializer) { return(UseSerializer(typeof(T), serializer)); }