示例#1
0
        /// <summary>
        /// Instancia um novo objeto GUID com o valor passado
        /// </summary>
        /// <param name="guid">valor do GUID</param>
        public GUID(IID guid)
        {
            long result = 0;

            long.TryParse(guid == null ? "" : guid.ToString(), out result);
            this.guid = result;
        }
示例#2
0
        public Command CreateCommandDelete(TableDefinitionAttribute tableDefinition, IID id)
        {
            Command command = connection.CreateCommand();

            command.Transaction = transaction;
            string pkName      = GetPKName(tableDefinition);
            string commandText = "";

            commandText = string.Format("DELETE FROM {0} WHERE {1} = @where_1;", tableDefinition.TableName, pkName);

            command.CommandText = commandText;
            command.Parameters.Add(new Parameter("@where_1", GenericDbType.String)
            {
                SourceColumn = pkName,
                Value        = id.ToString()
            });

            return(command);
        }
示例#3
0
        public static short getOpCode(this IID id)
        {
            var member = typeof(IID).GetMember(id.ToString()).FirstOrDefault(m => m.DeclaringType == typeof(IID));

            if (member is null)
            {
                throw new InvalidOperationException();
            }


            var attr = member.GetCustomAttributes(typeof(OpCodeAttribute), false).FirstOrDefault() as OpCodeAttribute;

            if (attr is null)
            {
                throw new
                      InvalidOperationException(
                          $"Field '{id}' of type '{nameof(IID)}' not found '{nameof(OpCodeAttribute)}' attribute. ");
            }

            return(attr.OpCode);
        }
示例#4
0
 public virtual Parser <string> InstructionToken(IID instruction) =>
 (from dot in Parse.Char('.')
  from ident in Parse.String(instruction.ToString().Replace("_", ".")).Text()
  select ident).Token().Named($"{instruction} expression");