Beispiel #1
0
        public static EntityTableConfig <T> AddIgnoredProp <T, P>(this EntityTableConfig <T> config, Expression <Func <T, P> > propertySelector)
        {
            var property = propertySelector.GetPropertyInfo();

            config.IgnoredProps.Add(property.Name);
            return(config);
        }
Beispiel #2
0
        public static EntityTableConfig <T> SetPrimaryKey <T, P>(this EntityTableConfig <T> config, Expression <Func <T, P> > propertySelector)
        {
            var property = propertySelector.GetPropertyInfo();

            config.PrimaryKey = property;
            return(config);
        }
        public static IEntityTableClient <T> Create <T>(
            Action <EntityTableClientOptions> optionsAction,
            Action <EntityTableConfig <T> > configAction)
            where T : class, new()
        {
            var config  = new EntityTableConfig <T>();
            var options = new EntityTableClientOptions()
            {
                TableName = typeof(T).Name
            };

            optionsAction?.Invoke(options);
            configAction?.Invoke(config);
            return(new EntityTableClient <T>(options, config));
        }
Beispiel #4
0
 public static EntityTableConfig <T> SetPartitionKey <T>(this EntityTableConfig <T> config, Func <T, string> partitionKeyResolver)
 {
     config.PartitionKeyResolver = partitionKeyResolver;
     return(config);
 }
Beispiel #5
0
 public static EntityTableConfig <T> RemoveObserver <T>(this EntityTableConfig <T> config, string observerName)
 {
     config.Observers.TryRemove(observerName, out var _);
     return(config);
 }
Beispiel #6
0
 public static EntityTableConfig <T> AddObserver <T>(this EntityTableConfig <T> config, string observerName, IEntityObserver <T> entityObserver)
 {
     config.Observers.TryAdd(observerName, entityObserver);
     return(config);
 }
Beispiel #7
0
 public static EntityTableConfig <T> AddComputedProp <T>(this EntityTableConfig <T> config, string propName, Func <T, object> propValue)
 {
     config.ComputedProps.Add(propName, propValue);
     return(config);
 }
Beispiel #8
0
 public static EntityTableConfig <T> AddIndex <T>(this EntityTableConfig <T> config, string propName)
 {
     config.ComputedIndexes.Add(propName);
     return(config);
 }