public AggregateOid(string[] strings) { var helper = new StringDecoderHelper(strings); typeName = helper.GetNextString(); fieldName = helper.GetNextString(); if (helper.HasNext) { parentOid = (IOid) helper.GetNextEncodedToStrings(); } }
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(); } }
public CollectionMemento(string[] strings) { var helper = new StringDecoderHelper(strings, true); string specName = helper.GetNextString(); string actionId = helper.GetNextString(); var targetOid = (IOid) helper.GetNextEncodedToStrings(); Target = RestoreObject(targetOid); Action = Target.GetActionLeafNode(actionId); var parameters = new List<INakedObject>(); while (helper.HasNext) { var parmType = helper.GetNextEnum<ParameterType>(); switch (parmType) { case ParameterType.Value: object obj = helper.GetNextObject(); parameters.Add(PersistorUtils.CreateAdapter(obj)); break; case ParameterType.Object: var oid = (IOid) helper.GetNextEncodedToStrings(); INakedObject nakedObject = RestoreObject(oid); parameters.Add(nakedObject); break; case ParameterType.ValueCollection: Type vInstanceType; IList<object> vColl = helper.GetNextValueCollection(out vInstanceType); IList typedVColl = CollectionUtils.ToTypedIList(vColl, vInstanceType); parameters.Add(PersistorUtils.CreateAdapter(typedVColl)); 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(PersistorUtils.CreateAdapter(typedOColl)); break; default: throw new ArgumentException(string.Format("Unexpected parameter type value: {0}", parmType)); } } Parameters = parameters.ToArray(); }
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(); }
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(Log.LogAndReturn($"Unexpected parameter type value: {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(); }
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(); }
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(); }