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)); } }
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)); }