示例#1
0
        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
        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)
                       ));
        }