public DapperRow(DapperTable table, object[] values) { if (table == null) { throw new ArgumentNullException(nameof(table)); } if (values == null) { throw new ArgumentNullException(nameof(values)); } this.table = table; this.values = values; }
internal static PropertyDescriptorCollection GetProperties(DapperTable table, IDictionary<string,object> row = null) { string ] names = table?.FieldNames; if (names == null || names.Length == 0) return PropertyDescriptorCollection.Empty; var arr = new PropertyDescriptor names.Length]; for (int i = 0; i < arr.Length; i++) { var type = row != null && row.TryGetValue(names i], out var value) && value != null ? value.GetType() : typeof(object); arr i] = new RowBoundPropertyDescriptor(type, names i], i); } return new PropertyDescriptorCollection(arr, true); }
public static Task CreateDatabase(this IDbConnection connection, Assembly assemblyOfModels, IEnumerable <RelationDataType> relationsDataType, DapperDatabase dapperDatabase) { return(Task.Factory.StartNew(() => { var tablesTypes = assemblyOfModels.GetTypes() .Where(a => a.GetCustomAttributes(true).OfType <TableAttribute>().Any()); DapperField.SetarRelationDataTypes(relationsDataType); var dapperTables = (from tableType in tablesTypes select DapperTable.Criar(tableType)).ToList(); CreateSequences(dapperTables, dapperDatabase, connection); CreateTables(dapperTables, dapperDatabase, connection); CreatePrimaryKeys(dapperTables, dapperDatabase, connection); CreateForeignKeys(dapperTables, dapperDatabase, connection); })); }
public DapperRow(DapperTable table, object ] values) { this.table = table ?? throw new ArgumentNullException(nameof(table)); this.values = values ?? throw new ArgumentNullException(nameof(values)); }