public NakedObjectAdapter(IMetamodelManager metamodel,
                                  ISession session,
                                  IObjectPersistor persistor,
                                  ILifecycleManager lifecycleManager,
                                  INakedObjectManager nakedObjectManager,
                                  object poco,
                                  IOid oid,
                                  ILoggerFactory loggerFactory,
                                  ILogger <NakedObjectAdapter> logger)
        {
            this.metamodel          = metamodel ?? throw new InitialisationException($"{nameof(metamodel)} is null");
            this.session            = session ?? throw new InitialisationException($"{nameof(session)} is null");
            this.persistor          = persistor ?? throw new InitialisationException($"{nameof(persistor)} is null");
            this.nakedObjectManager = nakedObjectManager ?? throw new InitialisationException($"{nameof(nakedObjectManager)} is null");
            this.logger             = logger ?? throw new InitialisationException($"{nameof(logger)} is null");
            this.lifecycleManager   = lifecycleManager ?? throw new InitialisationException($"{nameof(lifecycleManager)} is null");

            if (poco is INakedObjectAdapter)
            {
                throw new AdapterException(logger.LogAndReturn($"Adapter can't be used to adapt an adapter: {poco}"));
            }

            Object       = poco;
            Oid          = oid;
            ResolveState = new ResolveStateMachine(this, session);
            Version      = new NullVersion(loggerFactory.CreateLogger <NullVersion>());
        }
 private static IVersion GetVersion(XElement node, string user) {
     IVersion version = new NullVersion();
     if (node.Attribute("ver") != null) {
         long versionVal = Convert.ToInt64(node.Attribute("ver").Value, 16);
         version = new FileVersion(user, versionVal);
     }
     return version;
 }