예제 #1
0
        public TRow FindById(object id)
        {
            if (_metadata.IdColumn.Type != DbTypeHelpers.GetDbType(id.GetType()))
            {
                throw new ArgumentException($"Could not map the type {id.GetType().FullName} to the Id column DB type {_metadata.IdColumn.Type.ToString()}");
            }

            return(_data.FindRow(id));
        }
예제 #2
0
        public TableMetadata(Table table)
        {
            var columnsProps = table.GetType().GetProperties(BindingFlags.Public)
                               .Where(prop => prop.PropertyType.IsPrimitive || prop.PropertyType == typeof(decimal) || prop.PropertyType == typeof(string));

            foreach (var prop in columnsProps)
            {
                Columns.Add(new ColumnMetadata {
                    Type = DbTypeHelpers.GetDbType(prop.PropertyType)
                });
            }
        }