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

            user = helper.GetNextString();
            time = new DateTime(helper.GetNextLong());
            version = helper.GetNextObject();
        }
예제 #2
0
        public ConcurrencyCheckVersion(IMetamodelManager metamodel, string[] strings) {
            Assert.AssertNotNull(metamodel);
            var helper = new StringDecoderHelper(metamodel, strings);

            user = helper.GetNextString();
            time = new DateTime(helper.GetNextLong());
            version = helper.GetNextObject();
        }
 public AggregateOid(string[] strings) {
     var helper = new StringDecoderHelper(strings);
     typeName = helper.GetNextString();
     fieldName = helper.GetNextString();
     if (helper.HasNext) {
         parentOid = (IOid) helper.GetNextEncodedToStrings();
     }
 }
        public ViewModelOid(string[] strings) {
            var helper = new StringDecoderHelper(strings);
            TypeName = helper.GetNextString();

            Keys = helper.HasNext ? helper.GetNextArray() : new[] {System.Guid.NewGuid().ToString()};

            IsTransient = false;
            CacheState();
        }
예제 #5
0
 public AggregateOid(IMetamodelManager metamodel, string[] strings) {
     Assert.AssertNotNull(metamodel);
     this.metamodel = metamodel;
     var helper = new StringDecoderHelper(metamodel, strings);
     typeName = helper.GetNextString();
     fieldName = helper.GetNextString();
     if (helper.HasNext) {
         parentOid = (IOid) helper.GetNextEncodedToStrings();
     }
 }
예제 #6
0
        public ViewModelOid(IMetamodelManager metamodel, string[] strings) {
            Assert.AssertNotNull(metamodel);
            this.metamodel = metamodel;
            var helper = new StringDecoderHelper(metamodel, strings);
            TypeName = helper.GetNextString();

            Keys = helper.HasNext ? helper.GetNextArray() : new[] {Guid.NewGuid().ToString()};

            IsTransient = false;
            CacheState();
        }
예제 #7
0
        public SerialOid(string[] strings) {
            var helper = new StringDecoderHelper(strings);

            typeName = helper.GetNextString();
            serialNo = helper.GetNextLong();
            isTransient = helper.GetNextBool();

            if (helper.HasNext) {
                bool hasPrevious = helper.GetNextBool();
                if (hasPrevious) {
                    previous = (SerialOid) helper.GetNextEncodedToStrings();
                }
            }
            CacheState();
        }
예제 #8
0
        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 CollectionMemento(ILifecycleManager lifecycleManager, INakedObjectManager nakedObjectManager, IMetamodelManager metamodel, string[] strings)
            : this(lifecycleManager, nakedObjectManager, metamodel) {
            var helper = new StringDecoderHelper(metamodel, strings, true);
            // ReSharper disable once UnusedVariable
            string specName = helper.GetNextString();
            string actionId = helper.GetNextString();
            var targetOid = (IOid) helper.GetNextEncodedToStrings();

            Target = RestoreObject(targetOid);
            Action = Target.GetActionLeafNode(actionId);

            var parameters = new List<INakedObjectAdapter>();

            while (helper.HasNext) {
                var parmType = helper.GetNextEnum<ParameterType>();

                switch (parmType) {
                    case ParameterType.Value:
                        object obj = helper.GetNextObject();
                        parameters.Add(nakedObjectManager.CreateAdapter(obj, null, null));
                        break;
                    case ParameterType.Object:
                        var oid = (IOid) helper.GetNextEncodedToStrings();
                        INakedObjectAdapter nakedObjectAdapter = RestoreObject(oid);
                        parameters.Add(nakedObjectAdapter);
                        break;
                    case ParameterType.ValueCollection:
                        Type vInstanceType;
                        IList<object> vColl = helper.GetNextValueCollection(out vInstanceType);
                        IList typedVColl = CollectionUtils.ToTypedIList(vColl, vInstanceType);
                        parameters.Add(nakedObjectManager.CreateAdapter(typedVColl, null, null));
                        break;
                    case ParameterType.ObjectCollection:
                        Type oInstanceType;
                        List<object> oColl = helper.GetNextObjectCollection(out oInstanceType).Cast<IOid>().Select(o => RestoreObject(o).Object).ToList();
                        IList typedOColl = CollectionUtils.ToTypedIList(oColl, oInstanceType);
                        parameters.Add(nakedObjectManager.CreateAdapter(typedOColl, null, null));
                        break;
                    default:
                        throw new ArgumentException(string.Format("Unexpected parameter type value: {0}", parmType));
                }
            }

            Parameters = parameters.ToArray();
        }
        public EntityOid(IMetamodelManager metamodel, string[] strings)
        {
            Assert.AssertNotNull(metamodel);
            this.metamodel = metamodel;
            var helper = new StringDecoderHelper(metamodel, 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();
        }
예제 #11
0
        public EntityOid(IMetamodelManager metamodel, ILoggerFactory loggerFactory, string[] strings)
        {
            this.metamodel = metamodel ?? throw new InitialisationException($"{nameof(metamodel)} is null");
            logger         = loggerFactory.CreateLogger <EntityOid>();
            var helper = new StringDecoderHelper(metamodel, loggerFactory, loggerFactory.CreateLogger <StringDecoderHelper>(), strings);

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

            if (helper.HasNext)
            {
                var hasPrevious = helper.GetNextBool();
                if (hasPrevious)
                {
                    previous = (EntityOid)helper.GetNextEncodedToStrings();
                }
            }

            CacheState();
        }
예제 #12
0
        public EntityOid(IMetamodelManager metamodel, string[] strings) {
            Assert.AssertNotNull(metamodel);
            this.metamodel = metamodel;
            var helper = new StringDecoderHelper(metamodel, 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();
        }