public EntityOid(string[] strings) {
            var helper = new StringDecoderHelper(strings);

            TypeName = helper.GetNextString();
            Key = helper.GetNextObjectArray();
            IsTransient = helper.GetNextBool();
            EntityKey = (EntityKey) helper.GetNextSerializable();

            if (helper.HasNext) {
                bool hasPrevious = helper.GetNextBool();
                if (hasPrevious) {
                    previous = (EntityOid) helper.GetNextEncodedToStrings();
                }
            }
            CacheState();
        }
 public IOid CreateTransientOid(object obj) {
     var oid = new EntityOid(obj.GetType(), new object[] {Interlocked.Increment(ref transientId)}, true);
     Log.DebugFormat("Created OID {0} for instance of {1}", oid, obj.GetType().FullName);
     return oid;
 }
 public void MakePersistentAndUpdateKey(object[] newKey) {
     ThrowErrorIfNotTransient(newKey);
     previous = new EntityOid(TypeName, Key) {IsTransient = IsTransient};
     Key = newKey; // after old key is saved ! 
     IsTransient = false;
     CacheState();
 }
 public void MakePersistent() {
     ThrowErrorIfNotTransient();
     previous = new EntityOid(TypeName, Key) {IsTransient = IsTransient};
     IsTransient = false;
     CacheState();
 }