예제 #1
0
 private static ITableArgumentBinding CreateBinding(Type entityType)
 {
     if (TableClient.ImplementsOrEqualsITableEntity(entityType))
     {
         Type genericType = typeof(TableEntityAsyncCollectorArgumentBinding <>).MakeGenericType(entityType);
         return((ITableArgumentBinding)Activator.CreateInstance(genericType));
     }
     else
     {
         Type genericType = typeof(PocoEntityAsyncCollectorArgumentBinding <>).MakeGenericType(entityType);
         return((ITableArgumentBinding)Activator.CreateInstance(genericType));
     }
 }
예제 #2
0
        public ITableArgumentBinding TryCreate(Type parameterType)
        {
            if (!parameterType.IsGenericType ||
                (parameterType.GetGenericTypeDefinition() != typeof(IAsyncCollector <>)))
            {
                return(null);
            }

            Type entityType = GetCollectorItemType(parameterType);

            if (!TableClient.ImplementsOrEqualsITableEntity(entityType))
            {
                TableClient.VerifyContainsProperty(entityType, "RowKey");
                TableClient.VerifyContainsProperty(entityType, "PartitionKey");
            }

            return(CreateBinding(entityType));
        }