コード例 #1
0
        public SqlServerEntityCollector(SqlServerAttribute attribute)
        {
            _attribute = attribute;

            _sqlConnectionBuilder = new SqlConnectionStringBuilder
            {
                DataSource     = attribute.DatabaseServer,
                UserID         = attribute.User,
                Password       = attribute.Password,
                InitialCatalog = attribute.Database
            };
        }
        private Task <IValueBinder> BindForTypeOfEntity(SqlServerAttribute attribute, Type entityType)
        {
            var builder = new SqlConnectionStringBuilder
            {
                DataSource     = attribute.DatabaseServer,
                UserID         = attribute.User,
                Password       = attribute.Password,
                InitialCatalog = attribute.Database
            };

            var entityQuery = new EntityQuery
            {
                SchemaName = attribute.Schema,
                TableName  = attribute.Table,
                EntityId   = attribute.EntityId
            };

            var entity        = typeof(SqlServerEntity <>).MakeGenericType(entityType);
            var entityBinding = (IValueBinder)Activator.CreateInstance(entity, builder.ConnectionString, entityQuery);

            return(Task.FromResult(entityBinding));
        }
コード例 #3
0
 public IAsyncCollector <T> Convert(SqlServerAttribute attribute)
 {
     return(new SqlServerEntityCollector <T>(attribute));
 }