当前位置: 首页>>代码示例>>C#>>正文


C# IGraphDB.GetType方法代码示例

本文整理汇总了C#中IGraphDB.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IGraphDB.GetType方法的具体用法?C# IGraphDB.GetType怎么用?C# IGraphDB.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IGraphDB的用法示例。


在下文中一共展示了IGraphDB.GetType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Import

        public IEnumerable<IVertexView> Import(String myLocation,
            IGraphDB myGraphDB,
            IGraphQL myGraphQL,
            SecurityToken mySecurityToken,
            Int64 myTransactionToken,
            UInt32 myParallelTasks = 1U,
            IEnumerable<string> myComments = null,
            UInt64? myOffset = null,
            UInt64? myLimit = null,
            VerbosityTypes myVerbosityType = VerbosityTypes.Silent,
            Dictionary<string, string> myOptions = null)
        {
            if (myGraphDB == null)
                throw new ArgumentNullException("myGraphDB");

            if (myGraphQL == null)
                throw new ArgumentNullException("myGraphQL");

            if (!typeof(SonesGraphDB).Equals(myGraphDB.GetType()))
                throw new ArgumentException("FASTIMPORT is designed for SonesGraphDB only.");

            lock (_lock)
            {
                //if verbositiy is silent, we do not configure the logger, so it is an empty logger.
                if (myVerbosityType != VerbosityTypes.Silent)
                {
                    Level logLevel = (myVerbosityType == VerbosityTypes.Full)
                        ? Level.FINE
                        : Level.INFO;
                    LogManager.Instance.ConfigureLogger("FastImport", new FileLogger(_logpath, logLevel));
                }

                //store some arguments as fields, because there is at most one execution at any time.
                _logger = LogManager.Instance.GetLogger("FastImport");
                _db = myGraphDB;
                _ql = myGraphQL;
                _security = mySecurityToken;
                _transaction = myTransactionToken;
                _offset = myOffset;
                _limit = myLimit;
                _currentImport = 0L;
                _closed = false;
                _autoCreateIncomingEdges = false;

                if (myOptions != null)
                {
                    if (myOptions.ContainsKey("AutoCreateIncomingEdges"))
                        bool.TryParse(myOptions["AutoCreateIncomingEdges"], out _autoCreateIncomingEdges);
                }

                if (!_autoCreateIncomingEdges)
                    _sorter = new IncomingEdgeSorter(myOptions);

                try
                {
                    if (myLocation.ToLower().StartsWith(@"file:\\"))
                    {
                        stream = GetStreamFromFile(myLocation.Substring(@"file:\\".Length));
                    }
                    else
                    {
                        _logger.Log(Level.SEVERE, "Location does not start with file:\\\\.");
                        throw new InvalidImportLocationException(myLocation, @"file:\\");
                    }

                    #region Start import using the AGraphDBImport implementation and return the result

                    return Import();

                    #endregion
                }
                catch (Exception ex)
                {
                    //if something unexpected happens we log it and return a query result with failed.
                    _logger.Log(Level.SEVERE, "Exception thrown:\n", ex);
                    throw new ImportFailedException(ex);
                }
                finally
                {
                    if (stream != null)
                    {
                        _logger.Log(Level.FINE, "Stream closed");
                        stream.Dispose();
                        if (_sorter != null)
                            _sorter.Dispose();
                    }
                }
            }
        }
开发者ID:cosh,项目名称:sones,代码行数:89,代码来源:XMLBulkImportPlugin.cs


注:本文中的IGraphDB.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。