Пример #1
0
        public static ModelBuilder.EntityBuilder <TEntity> Timestamp <TEntity>([NotNull] this ModelBuilder.EntityBuilder <TEntity> builder, [NotNull] string name, bool shadowProperty = false)
        {
            Check.NotNull(builder, "builder");
            Check.NotEmpty(name, "name");

            builder.Property <TEntity>(name, shadowProperty).ColumnName("Timestamp");

            return(builder);
        }
Пример #2
0
        public static ModelBuilder.EntityBuilder <TEntity> Timestamp <TEntity>([NotNull] this ModelBuilder.EntityBuilder <TEntity> builder, [NotNull] Expression <Func <TEntity, object> > expression)
        {
            Check.NotNull(builder, "builder");
            Check.NotNull(expression, "expression");

            builder.Property(expression).ColumnName("Timestamp");

            return(builder);
        }
Пример #3
0
        /// <summary>
        ///     Sets the partition key, row key, and creates a composite entity key
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <param name="builder"></param>
        /// <param name="partitionKeyExpression"></param>
        /// <param name="rowKeyExpression"></param>
        /// <returns></returns>
        public static ModelBuilder.EntityBuilder <TEntity> PartitionAndRowKey <TEntity>([NotNull] this ModelBuilder.EntityBuilder <TEntity> builder, [NotNull] Expression <Func <TEntity, object> > partitionKeyExpression, [NotNull] Expression <Func <TEntity, object> > rowKeyExpression)
        {
            Check.NotNull(builder, "builder");
            Check.NotNull(partitionKeyExpression, "partitionKeyExpression");
            Check.NotNull(rowKeyExpression, "rowKeyExpression");

            builder.Property(partitionKeyExpression).ColumnName("PartitionKey");
            builder.Property(rowKeyExpression).ColumnName("RowKey");

            var properties = partitionKeyExpression.GetPropertyAccessList().ToList();

            properties.Add(rowKeyExpression.GetPropertyAccess());
            builder.Key(properties.Select(s => s.Name).ToArray());
            return(builder);
        }