Esempio n. 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;
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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");