///-------------------------------------------------------------------------------------------------
        /// <summary>
        ///  Constructor.
        /// </summary>
        /// <param name="adapter">
        ///  The adapter.
        /// </param>
        ///-------------------------------------------------------------------------------------------------
        public MemoryIndexManager(IHyperGraph adapter)
        {
            Contract.Requires(adapter, "adapter");

            _indexByNames = PlatformServices.Current.CreateConcurrentDictionary <string, IndexDefinition>();
            _graph        = adapter;
        }
Esempio n. 2
0
        ///-------------------------------------------------------------------------------------------------
        /// <summary>
        ///  Constructor.
        /// </summary>
        /// <param name="graph">
        ///  The graph.
        /// </param>
        /// <param name="name">
        ///  The name.
        /// </param>
        /// <param name="unique">
        ///  true to unique.
        /// </param>
        ///-------------------------------------------------------------------------------------------------
        public BTreeIndex(IHyperGraph graph, string name, bool unique)
        {
            DebugContract.Requires(graph);
            DebugContract.RequiresNotEmpty(name);

            _graph  = new WeakReference(graph);
            Name    = name;
            _unique = unique;
        }
Esempio n. 3
0
        ///-------------------------------------------------------------------------------------------------
        /// <summary>
        ///  Releases the unmanaged resources used by the Hyperstore.Modeling.Domain.DomainModel and
        ///  optionally releases the managed resources.
        /// </summary>
        /// <param name="disposing">
        ///  true to release both managed and unmanaged resources; false to release only unmanaged
        ///  resources.
        /// </param>
        ///-------------------------------------------------------------------------------------------------
        protected virtual void Dispose(bool disposing)
        {
            var tmp = DomainUnloaded;

            if (tmp != null)
            {
                tmp(this, new EventArgs());
            }

            if (L1Cache != null)
            {
                L1Cache.Dispose();
            }

            var disposable = InnerGraph as IDisposable;

            if (disposable != null)
            {
                disposable.Dispose();
            }
            InnerGraph = null;

            disposable = _commandManager as IDisposable;
            if (disposable != null)
            {
                disposable.Dispose();
            }
            _commandManager = null;

            disposable = _eventManager as IDisposable;
            if (disposable != null)
            {
                disposable.Dispose();
            }
            _eventManager = null;

            disposable = IdGenerator as IDisposable;
            if (disposable != null)
            {
                disposable.Dispose();
            }
            IdGenerator = null;

            disposable = _modelElementFactory as IDisposable;
            if (disposable != null)
            {
                disposable.Dispose();
            }
            _modelElementFactory = null;

            Services.Dispose();
            _disposed = true;
        }
Esempio n. 4
0
        ///-------------------------------------------------------------------------------------------------
        /// <summary>
        ///  Constructor.
        /// </summary>
        /// <param name="graph">
        ///  The graph.
        /// </param>
        /// <param name="name">
        ///  The name.
        /// </param>
        /// <param name="metaClass">
        ///  The meta class.
        /// </param>
        /// <param name="unique">
        ///  true to unique.
        /// </param>
        /// <param name="propertyNames">
        ///  A list of names of the properties.
        /// </param>
        ///-------------------------------------------------------------------------------------------------
        public IndexDefinition(IHyperGraph graph, string name, ISchemaElement metaClass, bool unique, params string[] propertyNames)
        {
            DebugContract.Requires(graph);
            DebugContract.RequiresNotEmpty(name);
            DebugContract.Requires(metaClass);

            if (propertyNames.Length > 0)
            {
                PropertyNames = new string[propertyNames.Length];
                for (var i = 0; i < propertyNames.Length; i++)
                {
                    PropertyNames[i] = propertyNames[i];
                }
            }
            MetaClass = metaClass;
            Index     = new BTreeIndex(graph, name, unique);
        }
Esempio n. 5
0
        ///-------------------------------------------------------------------------------------------------
        /// <summary>
        ///  Determines if we can configure core.
        /// </summary>
        /// <returns>
        ///  true if it succeeds, false if it fails.
        /// </returns>
        ///-------------------------------------------------------------------------------------------------
        protected virtual bool ConfigureCore()
        {
            if (_initialized)
            {
                return(true);
            }

            _initialized = true;
            Statistics   = new DomainStatistics();

            OnInitializing();

            _eventManager        = Resolve(ResolveEventManager);
            IdGenerator          = Resolve(ResolveIdGenerator);
            _modelElementFactory = Resolve(ResolveModelElementFactory);
            _commandManager      = Resolve(ResolveCommandManager);
            InnerGraph           = Resolve(ResolveHyperGraph);
            L1Cache = new Level1Cache(this);

            OnInitialized();

            return(false);
        }
 ///-------------------------------------------------------------------------------------------------
 /// <summary>
 ///  Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged
 ///  resources.
 /// </summary>
 ///-------------------------------------------------------------------------------------------------
 public void Dispose()
 {
     _graph = null;
 }