Esempio n. 1
0
        /// <summary>
        /// Opens a new workspace with assumed latest available snapshot
        /// </summary>
        /// <typeparam name="TDataType">Type of root entity interface for data navigation. This is the "all containing" entity, which has access to all other entities.</typeparam>
        /// <param name="isolationLevel">Workspace isolation</param>
        /// <param name="timeout">Workspace timeout</param>
        /// <returns>New workspace instance</returns>
        public Workspace <TDataType> OpenWorkspace <TDataType>(IsolationLevel isolationLevel, TimeSpan timeout)
        {
            if (!snapshotIsolationEnabled && isolationLevel == IsolationLevel.Snapshot)
            {
                throw new ArgumentException("Snapshot isolation level disabled by configuration");
            }

            if (isolationLevel == IsolationLevel.Exclusive)
            {
                serverContext.EnterExclusiveLock();
            }

            Guid snapshotId = serverContext.LastSnapshotId();

            return(new Workspace <TDataType>(snapshotId, timeout, provider, serverContext, proxyCreatorService, typesService, isolationLevel, immutableProxyMap));
        }