Example #1
0
        private static IDbTable MockIdentityOutputTable(Model model, SqlSession sqlSession, IList <SqlCommand> commands)
        {
            var identity = model.GetIdentity(false);

            if (identity == null)
            {
                return(null);
            }

            var column = identity.Column;

            if (column is _Int32)
            {
                return(sqlSession.MockTempTable <Int32IdentityOutput>(commands));
            }
            else if (column is _Int64)
            {
                return(sqlSession.MockTempTable <Int64IdentityOutput>(commands));
            }
            else if (column is _Int16)
            {
                return(sqlSession.MockTempTable <Int16IdentityOutput>(commands));
            }
            else
            {
                return(null);
            }
        }
        internal static DbTable <T> MockTempTable <T>(this SqlSession sqlSession, IList <SqlCommand> commands, T fromModel = null, Action <T> initializer = null)
            where T : Model, new()
        {
            var result = sqlSession.MockTempTable <T>(fromModel, initializer);

            commands.Add(sqlSession.GetCreateTableCommand(result.Model, true));
            return(result);
        }