コード例 #1
0
ファイル: Transaction.cs プロジェクト: randianb/DownLoadDemo
        private void AddCommand <T>(TextType textType, T entity)
        {
            Command   command = null;
            MetaTable table   = MetaManager.GetMetaTable(typeof(T));

            switch (textType)
            {
            case TextType.Insert:
                command = table.GetInsertCommand(Provider.ParamPrefix, entity);
                break;

            case TextType.Update:
                command = table.GetUpdateCommand(Provider.ParamPrefix, entity);
                break;

            case TextType.Delete:
                command = table.GetDeleteCommand(Provider.ParamPrefix, entity);
                break;
            }
            if (command != null)
            {
                if (Commands == null)
                {
                    Commands = new List <Command>();
                }
                Commands.Add(command);
            }
        }
コード例 #2
0
ファイル: KQuery.cs プロジェクト: randianb/DownLoadDemo
        private Command GetCommand <T>(params object[] id)
        {
            MetaTable table = MetaManager.GetMetaTable(typeof(T));

            return(new Command(
                       String.Format(
                           "SELECT * FROM {0} WHERE {1}",
                           table.RowType.TableName,
                           table.GetKeyFieldString(Provider.ParamPrefix)
                           ),
                       table.GetKeyParameters(Provider.ParamPrefix, id)
                       ));
        }