NPoco.PocoDataFactory.TableInfoForType C# (CSharp) Method

TableInfoForType() public method

public TableInfoForType ( Type type ) : TableInfo
type Type
return TableInfo
        public TableInfo TableInfoForType(Type type)
        {
            Guard(type);
            var pocoDataBuilder = _pocoDatas.Get(type, () => BaseClassFalbackPocoDataBuilder(type));
            return pocoDataBuilder.BuildTableInfo();
        }

Usage Example

Example #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);
            }
        }
All Usage Examples Of NPoco.PocoDataFactory::TableInfoForType