Ejemplo n.º 1
0
        private DBTableMapping(IResolverProvider resolverProvider, DBConnectionWrapper currentConnection, DBTransactionWrapper currentTrans)
        {
            var mapping = DBObjectMapping <T> .Get();

            Sql sql = resolverProvider.SqlResolver.ColumnMetaDataFromTable(TableName, Schema);
            List <SchemaMetadata> metadatas = currentConnection.Query <SchemaMetadata>(sql, currentTrans);

            ColumnMappingList = mapping.ColumnMappingList
                                .Select(i => new DBColumnMappingInfo <T>(i, metadatas.Single(j => string.Compare(j.COLUMN_NAME, i.ColumnName, true) == 0)));
        }
Ejemplo n.º 2
0
        public override int Execute(ref T obj, DBConnectionWrapper conn, DBTransactionWrapper trans = null)
        {
            var sql = CreateSql(obj);
            var ret = conn.Query <T>(sql, trans).FirstOrDefault();

            if (ret != null)
            {
                obj = ret;
                return(1);
            }
            return(0);
        }