TableInfoForType() public method

public TableInfoForType ( Type type ) : TableInfo
type Type
return TableInfo
示例#1
0
        public async Task SaveAsync <T>(T poco)
        {
            var tableInfo = PocoDataFactory.TableInfoForType(poco.GetType());

            if (await IsNewAsync(poco).ConfigureAwait(false))
            {
                await InsertAsync(tableInfo.TableName, tableInfo.PrimaryKey, tableInfo.AutoIncrement, poco).ConfigureAwait(false);
            }
            else
            {
                await UpdateAsync(tableInfo.TableName, tableInfo.PrimaryKey, poco, null, null).ConfigureAwait(false);
            }
        }
示例#2
0
        /// <summary>
        /// Performs an SQL Insert
        /// </summary>
        /// <param name="poco">The POCO object that specifies the column values to be inserted</param>
        /// <returns>The auto allocated primary key of the new record, or null for non-auto-increment tables</returns>
        /// <remarks>The name of the table, it's primary key and whether it's an auto-allocated primary key are retrieved
        /// from the POCO's attributes</remarks>
        public Task <object> InsertAsync <T>(T poco)
        {
            var tableInfo = PocoDataFactory.TableInfoForType(poco.GetType());

            return(InsertAsync(tableInfo.TableName, tableInfo.PrimaryKey, tableInfo.AutoIncrement, poco));
        }
示例#3
0
        public Task <int> DeleteAsync(object poco)
        {
            var tableInfo = PocoDataFactory.TableInfoForType(poco.GetType());

            return(DeleteAsync(tableInfo.TableName, tableInfo.PrimaryKey, poco));
        }
示例#4
0
        public Task <int> UpdateAsync(object poco, object primaryKeyValue, IEnumerable <string> columns)
        {
            var tableInfo = PocoDataFactory.TableInfoForType(poco.GetType());

            return(UpdateAsync(tableInfo.TableName, tableInfo.PrimaryKey, poco, primaryKeyValue, columns));
        }