Ejemplo n.º 1
0
        public FactHandle <T> Add <T>(T fact)
            where T : class
        {
            if (fact == null)
            {
                throw new ArgumentNullException(nameof(fact));
            }

            var id = Interlocked.Increment(ref _nextId);

            var factHandle = new RuntimeFactHandle <T>(id, fact, Disconnect);

            lock (_connections)
            {
                _connections.Add(id, factHandle);
            }

            return(factHandle);
        }
Ejemplo n.º 2
0
 public bool Equals(RuntimeFactHandle <T> x, RuntimeFactHandle <T> y)
 {
     if (ReferenceEquals(x, y))
     {
         return(true);
     }
     if (ReferenceEquals(x, null))
     {
         return(false);
     }
     if (ReferenceEquals(y, null))
     {
         return(false);
     }
     if (x.GetType() != y.GetType())
     {
         return(false);
     }
     return(x._id == y._id);
 }
Ejemplo n.º 3
0
 public int GetHashCode(RuntimeFactHandle <T> obj)
 {
     return(obj._id.GetHashCode());
 }