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


C# LoadType类代码示例

本文整理汇总了C#中LoadType的典型用法代码示例。如果您正苦于以下问题:C# LoadType类的具体用法?C# LoadType怎么用?C# LoadType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1:

        protected void GenerateLoadSqlCommand
            (
            SqlCommand command, 
            LoadType loadType, 
            Guid keyToLoadBy, 
            Guid instanceId, 
            List<CorrelationKey> keysToAssociate
            )
        {
            long surrogateLockOwnerId = base.StoreLock.SurrogateLockOwnerId;
            byte[] concatenatedKeyProperties = null;
            bool singleKeyToAssociate = (keysToAssociate != null && keysToAssociate.Count == 1);

            if (keysToAssociate != null)
            {
                concatenatedKeyProperties = SerializationUtilities.CreateKeyBinaryBlob(keysToAssociate);
            }

            double operationTimeout = this.TimeoutHelper.RemainingTime().TotalMilliseconds;

            SqlParameterCollection parameters = command.Parameters;
            parameters.Add(new SqlParameter { ParameterName = "@surrogateLockOwnerId", SqlDbType = SqlDbType.BigInt, Value = surrogateLockOwnerId });
            parameters.Add(new SqlParameter { ParameterName = "@operationType", SqlDbType = SqlDbType.TinyInt, Value = loadType });
            parameters.Add(new SqlParameter { ParameterName = "@keyToLoadBy", SqlDbType = SqlDbType.UniqueIdentifier, Value = keyToLoadBy });
            parameters.Add(new SqlParameter { ParameterName = "@instanceId", SqlDbType = SqlDbType.UniqueIdentifier, Value = instanceId });
            parameters.Add(new SqlParameter { ParameterName = "@handleInstanceVersion", SqlDbType = SqlDbType.BigInt, Value = base.InstancePersistenceContext.InstanceVersion });
            parameters.Add(new SqlParameter { ParameterName = "@handleIsBoundToLock", SqlDbType = SqlDbType.Bit, Value = base.InstancePersistenceContext.InstanceView.IsBoundToLock });
            parameters.Add(new SqlParameter { ParameterName = "@keysToAssociate", SqlDbType = SqlDbType.Xml, Value = singleKeyToAssociate ? DBNull.Value : SerializationUtilities.CreateCorrelationKeyXmlBlob(keysToAssociate) });
            parameters.Add(new SqlParameter { ParameterName = "@encodingOption", SqlDbType = SqlDbType.TinyInt, Value = base.Store.InstanceEncodingOption });
            parameters.Add(new SqlParameter { ParameterName = "@concatenatedKeyProperties", SqlDbType = SqlDbType.VarBinary, Value = (object) concatenatedKeyProperties ?? DBNull.Value });
            parameters.Add(new SqlParameter { ParameterName = "@operationTimeout", SqlDbType = SqlDbType.Int, Value = (operationTimeout < Int32.MaxValue) ? Convert.ToInt32(operationTimeout) : Int32.MaxValue });
            parameters.Add(new SqlParameter { ParameterName = "@singleKeyId", SqlDbType = SqlDbType.UniqueIdentifier, Value = singleKeyToAssociate ? keysToAssociate[0].KeyId : (object) DBNull.Value });
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:33,代码来源:LoadWorkflowAsyncResult.cs

示例2: LoadFileGump

        public LoadFileGump( Mobile mobile, ArrayList argsList, LoadType loadtype, string filename )
            : base(0,0)
        {
            gumpMobile = mobile;

            ArgsList = argsList;
            GetArgsList();

            GetTextColors();

            loadType = loadtype;
            FileName = filename;

            AddPage(0); // Page 0

            MC.DisplayStyle( this, StyleTypeConfig, 180, 180, 340, 120 );

            MC.DisplayBackground( this, BackgroundTypeConfig, 200, 200, 300, 40 );
            MC.DisplayBackground( this, BackgroundTypeConfig, 200, 260, 300, 20 );

            AddHtml( 221, 181, 280, 20, MC.ColorText( titleTextColor, "Load File" ), false, false );

            switch ( loadType )
            {
                case LoadType.Manual:
                {
                    AddHtml( 201, 201, 280, 20, MC.ColorText( defaultTextColor, "Type in the filename to load:" ), false, false );
                    MC.DisplayBackground( this, ActiveTEBGTypeConfig, 200, 220, 300, 18 );
                    AddTextEntry( 200, 220, 300, 15, ActiveTextEntryTextColor, 0, "" );

                    break;
                }
                case LoadType.FileBrowserMsf:
                {
                    AddHtml( 201, 201, 280, 20, MC.ColorText( defaultTextColor, "Are you sure you want to load file:" ), false, false );
                    AddHtml( 201, 221, 280, 20, MC.ColorText( defaultTextColor, MC.CropDirectory( FileName ) ), false, false );

                    break;
                }
                case LoadType.FileBrowserMbk:
                {
                    MC.DisplayStyle( this, StyleTypeConfig, 180, 160, 340, 20 );
                    MC.DisplayBackground( this, BackgroundTypeConfig, 181, 161, 338, 18 );

                    AddHtml( 201, 161, 280, 20, MC.ColorText( defaultTextColor, "Warning: All Mega Spawners will be removed." ), false, false );
                    AddHtml( 201, 201, 280, 20, MC.ColorText( defaultTextColor, "Are you sure you want to load backup file:" ), false, false );
                    AddHtml( 201, 221, 280, 20, MC.ColorText( defaultTextColor, MC.CropDirectory( FileName ) ), false, false );

                    break;
                }
            }

            AddHtml( 441, 261, 60, 20, MC.ColorText( defaultTextColor, "Cancel" ), false, false );
            AddButton( 400, 260, 4017, 4019, 0, GumpButtonType.Reply, 0 );

            AddHtml( 241, 261, 60, 20, MC.ColorText( defaultTextColor, "Ok" ), false, false );
            AddButton( 200, 260, 4023, 4025, 1, GumpButtonType.Reply, 0 );
        }
开发者ID:cynricthehun,项目名称:UOLegends,代码行数:58,代码来源:LoadFileGump.cs

示例3: LoadDataset

 // Database simulation
 public static IPoints LoadDataset(string websitepath, LoadType loadType = LoadType.Csv)
 {
     switch (loadType)
     {
         case LoadType.Serialized: throw new NotSupportedException(MethodBase.GetCurrentMethod().ToString());
         case LoadType.Csv: return LoadDatasetFromCsv(websitepath);                    
         default: throw new ApplicationException("LoadDatasetFromDatabase unknown loadtype");
     }
 }
开发者ID:trevorjobling,项目名称:Google-Maps-Clustering-CSharp,代码行数:10,代码来源:Dataset.cs

示例4: LoadContent

        public void LoadContent(string filename, List<List<string>> attributes, List<List<string>> contents, string identifier)
        {
            using (StreamReader reader = new StreamReader(filename))
            {
                while (!reader.EndOfStream)
                {
                    string line = reader.ReadLine();
                    if (line.Contains("EndLoad=") && line.Contains(identifier))
                    {
                        identifierFound = false;
                        break;
                    }
                    else if (line.Contains("Load=") && line.Contains(identifier))
                    {
                        identifierFound = true;
                        continue;
                    }

                    if (identifierFound)
                    {
                        if (line.Contains("Load="))
                        {
                            tempAttributes = new List<string>();
                            line = line.Remove(0, line.IndexOf("=") + 1);
                            type = LoadType.Attributes;
                        }
                        else
                        {
                            tempContents = new List<string>();
                            type = LoadType.Contents;
                        }

                        string[] lineArray = line.Split(']');
                        foreach (string li in lineArray)
                        {
                            string newLine = li.Trim('[', ' ', ']');
                            if (newLine != String.Empty)
                            {
                                if (type == LoadType.Contents)
                                    tempContents.Add(newLine);
                                else
                                    tempAttributes.Add(newLine);
                            }
                        }

                        if (type == LoadType.Contents && tempContents.Count > 0)
                        {
                            contents.Add(tempContents);
                            attributes.Add(tempAttributes);
                        }
                    }
                }
            }
        }
开发者ID:elefantstudio-se,项目名称:ElefantStudio-Prototyp-Exempel,代码行数:54,代码来源:FileManager.cs

示例5: MetaReader

        public MetaReader(IStreamManager streamManager, uint baseOffset, ICacheFile cache, BuildInformation buildInfo, LoadType type, FieldChangeSet ignore)
        {
            _streamManager = streamManager;
            BaseOffset = baseOffset;
            _cache = cache;
            _ignoredFields = ignore;
            _type = type;

            // Load layouts
            _reflexiveLayout = buildInfo.GetLayout("reflexive");
            _tagRefLayout = buildInfo.GetLayout("tag reference");
            _dataRefLayout = buildInfo.GetLayout("data reference");
        }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:13,代码来源:MetaReader.cs

示例6: MetaReader

        public MetaReader(IStreamManager streamManager, uint baseOffset, ICacheFile cache, EngineDescription buildInfo,
			LoadType type, FieldChangeSet ignore)
        {
            _streamManager = streamManager;
            BaseOffset = baseOffset;
            _cache = cache;
            _ignoredFields = ignore;
            _type = type;

            // Load layouts
            _tagBlockLayout = buildInfo.Layouts.GetLayout("tag block");
            _tagRefLayout = buildInfo.Layouts.GetLayout("tag reference");
            _dataRefLayout = buildInfo.Layouts.GetLayout("data reference");
        }
开发者ID:Nibre,项目名称:Assembly,代码行数:14,代码来源:MetaReader.cs

示例7: LoadDocument

 public override XDocument LoadDocument(string location, LoadType type)
 {
     XDocument doc = new XDocument();
     try
     {
         if (type == LoadType.Disk)
         {
             doc = loadFromDisk(location);
         }
     }
     catch (Exception ex)
     {
         throw new InvalidInputFileException(ex);
     }
     return doc;
 }
开发者ID:Derek-C-Jones,项目名称:CyclePro,代码行数:16,代码来源:GPXHandler.cs

示例8: LoadEventListener

		static LoadEventListener()
		{
			Reload = new LoadType("Get")
				.SetAllowNulls(false)
				.SetAllowProxyCreation(false)
				.SetCheckDeleted(true)
				.SetNakedEntityReturned(false)
				.SetExactPersister(true); // NH: Different behavior to pass NH-295

			Get = new LoadType("Get")
				.SetAllowNulls(true)
				.SetAllowProxyCreation(false)
				.SetCheckDeleted(true)
				.SetNakedEntityReturned(false)
				.SetExactPersister(true); // NH: Different behavior to pass NH-295

			Load = new LoadType("Load")
				.SetAllowNulls(false)
				.SetAllowProxyCreation(true)
				.SetCheckDeleted(true)
				.SetNakedEntityReturned(false);

			ImmediateLoad = new LoadType("ImmediateLoad")
				.SetAllowNulls(true)
				.SetAllowProxyCreation(false)
				.SetCheckDeleted(false)
				.SetNakedEntityReturned(true);

			InternalLoadEager = new LoadType("InternalLoadEager")
				.SetAllowNulls(false)
				.SetAllowProxyCreation(false)
				.SetCheckDeleted(false)
				.SetNakedEntityReturned(false);

			InternalLoadLazy = new LoadType("InternalLoadLazy")
				.SetAllowNulls(false)
				.SetAllowProxyCreation(true)
				.SetCheckDeleted(false)
				.SetNakedEntityReturned(false);

			InternalLoadNullable = new LoadType("InternalLoadNullable")
				.SetAllowNulls(true)
				.SetAllowProxyCreation(false)
				.SetCheckDeleted(false)
				.SetNakedEntityReturned(false);
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:46,代码来源:LoadEventListener.cs

示例9: DoLoad

        private void DoLoad(LoadType loadType)
        {
            lock (loadLock)
            {
                instance.timer.Change(Timeout.Infinite, Timeout.Infinite);
                var tran = Cat.NewTransaction("LoadDataSource", loadType.ToString());
                logger.Info("Load data source begin - " + loadType.ToString());

                try
                {
                    if (instance.names == null)
                        instance.names = instance.GetNames();

                    if (instance.names.Length > 0)
                    {
                        var coll = DataSourceProvider.GetProvider().GetConnectionStrings(instance.names);
                        DataSourceManager.AddConnectionStrings(coll);

                        string names = string.Join(",", DataSourceManager.GetAllNames());
                        Cat.LogEvent("LoadDataSource.Cache", "LoadDataSource.Cache.Entries", CatConstants.SUCCESS, names);
                        logger.Info("Data sources cached", names);
                    }

                    tran.Status = CatConstants.SUCCESS;
                }
                catch (Exception ex)
                {
                    var msg = "Error occured during loading data source.";
                    Cat.LogError(msg, ex);
                    tran.SetStatus(ex);
                    logger.Error(msg, ex);

                    if (loadType == LoadType.Initialize)
                        throw;
                }
                finally
                {
                    tran.Complete();
                    logger.Info("Load data source end.");
                    instance.timer.Change(ConfigHelper.UpdateInterval * 1000, Timeout.Infinite);
                }
            }
        }
开发者ID:felix-tien,项目名称:TechLab,代码行数:43,代码来源:DataSourceLoader.cs

示例10: LoadContent

        public void LoadContent(string filename, List<List<string>> loadAttributes, List<List<string>> loadContents)
        {
            using (StreamReader reader = new StreamReader(filename))
            {
                while(!reader.EndOfStream)
                {
                    string line = reader.ReadLine();

                    if (line.Contains("Load="))
                    {
                        tempAttributes = new List<string>();
                        line.Remove(0, line.IndexOf("=")-1);
                        type = LoadType.Attributes;
                    }
                    else
                    {
                        tempContents = new List<string>();
                        type = LoadType.Contents;
                    }

                    string[] lineArray = line.Split(']');

                    foreach (var li in lineArray)
                    {
                        string newLine = li.Trim('[', ' ', ']');
                        if (newLine != string.Empty)
                        {
                            if(type == LoadType.Contents)
                                tempContents.Add(newLine);
                            else
                                tempAttributes.Add(newLine);
                        }
                    }

                    if (type == LoadType.Contents && tempContents.Count > 0)
                    {
                        contents.Add(tempContents);
                        attributes.Add(tempAttributes);
                    }
                }
            }
        }
开发者ID:joel-briggs,项目名称:XnaPlatformer,代码行数:42,代码来源:FileManager.cs

示例11: addLoad

 //=====================================================================
 /// <summary>
 /// 加载资源,如果资源已经加载过,则直接从缓存中获取
 /// </summary>
 /// <param name="fullName">全名</param>
 /// <param name="priority">优先级</param>
 /// <param name="loadType">加载类型</param>
 /// <param name="loadStart">加载开始前执行的方法</param>
 /// <param name="loadProgress">加载开始后且在结束前每帧执行的方法</param>
 /// <param name="loadEnd">加载结束后执行的方法</param>
 /// <param name="loadFail">加载失败后执行的方法</param>
 /// <param name="unZipStart">解压开始前执行的方法</param>
 /// <param name="unZipProgress">解压开始后且在结束前每帧执行的方法</param>
 /// <param name="unZipEnd">解压完毕后执行的方法</param>
 /// <param name="unZipFail">解压失败后执行的方法</param>
 public void addLoad(string fullName, LoadPriority priority = LoadPriority.two, LoadType loadType = LoadType.local,
     LoadFunctionDele loadStart = null, LoadFunctionDele loadProgress = null, 
     LoadFunctionDele loadEnd = null, LoadFunctionDele loadFail = null,
     LoadFunctionDele unZipStart = null, LoadFunctionDele unZipProgress = null,
     LoadFunctionDele unZipEnd = null, LoadFunctionDele unZipFail = null)
 {
     LoadInfo loadInfo = new LoadInfo();
     loadInfo.fullName = fullName;
     loadInfo.priority = priority;
     loadInfo.loadType = loadType;
     loadInfo.loadStart = loadStart;
     loadInfo.loadProgress = loadProgress;
     loadInfo.loadEnd = loadEnd;
     loadInfo.loadFail = loadFail;
     loadInfo.unZipStart = unZipStart;
     loadInfo.unZipProgress = unZipProgress;
     loadInfo.unZipEnd = unZipEnd;
     loadInfo.unZipFail = unZipFail;
     addLoad(loadInfo);
 }
开发者ID:xqy,项目名称:game,代码行数:35,代码来源:LoadManager.cs

示例12: LoadFromSecondLevelCache

		/// <summary> Attempts to load the entity from the second-level cache. </summary>
		/// <param name="event">The load event </param>
		/// <param name="persister">The persister for the entity being requested for load </param>
		/// <param name="options">The load options. </param>
		/// <returns> The entity from the second-level cache, or null. </returns>
		protected virtual object LoadFromSecondLevelCache(LoadEvent @event, IEntityPersister persister, LoadType options)
		{
			ISessionImplementor source = @event.Session;
			bool useCache = persister.HasCache && ((source.CacheMode & CacheMode.Get) == CacheMode.Get)
				&& @event.LockMode.LessThan(LockMode.Read);

			if (useCache)
			{
				ISessionFactoryImplementor factory = source.Factory;

				CacheKey ck = new CacheKey(@event.EntityId, persister.IdentifierType, persister.RootEntityName, source.EntityMode, factory);
				object ce = persister.Cache.Get(ck, source.Timestamp);

				if (factory.Statistics.IsStatisticsEnabled)
				{
					if (ce == null)
					{
						factory.StatisticsImplementor.SecondLevelCacheMiss(persister.Cache.RegionName);
						log.DebugFormat("Entity cache miss: {0}", ck);
					}
					else
					{
						factory.StatisticsImplementor.SecondLevelCacheHit(persister.Cache.RegionName);
						log.DebugFormat("Entity cache hit: {0}", ck);
					}
				}

				if (ce != null)
				{
					CacheEntry entry = (CacheEntry) persister.CacheEntryStructure.Destructure(ce, factory);

					// Entity was found in second-level cache...
					// NH: Different behavior (take a look to options.ExactPersister (NH-295))
					if (!options.ExactPersister || persister.EntityMetamodel.SubclassEntityNames.Contains(entry.Subclass))
					{
						return AssembleCacheEntry(entry, @event.EntityId, persister, @event);
					}
				}
			}

			return null;
		}
开发者ID:Mrding,项目名称:Ribbon,代码行数:47,代码来源:DefaultLoadEventListener.cs

示例13: LoadFromSessionCache

		/// <summary>
		/// Attempts to locate the entity in the session-level cache.
		/// </summary>
		/// <param name="event">The load event </param>
		/// <param name="keyToLoad">The EntityKey representing the entity to be loaded. </param>
		/// <param name="options">The load options. </param>
		/// <returns> The entity from the session-level cache, or null. </returns>
		/// <remarks>
		/// If allowed to return nulls, then if the entity happens to be found in
		/// the session cache, we check the entity type for proper handling
		/// of entity hierarchies.
		/// If checkDeleted was set to true, then if the entity is found in the
		/// session-level cache, it's current status within the session cache
		/// is checked to see if it has previously been scheduled for deletion.
		/// </remarks>
		protected virtual object LoadFromSessionCache(LoadEvent @event, EntityKey keyToLoad, LoadType options)
		{
			ISessionImplementor session = @event.Session;
			object old = session.GetEntityUsingInterceptor(keyToLoad);

			if (old != null)
			{
				// this object was already loaded
				EntityEntry oldEntry = session.PersistenceContext.GetEntry(old);
				if (options.IsCheckDeleted)
				{
					Status status = oldEntry.Status;
					if (status == Status.Deleted || status == Status.Gone)
					{
						return RemovedEntityMarker;
					}
				}
				if (options.IsAllowNulls)
				{
					IEntityPersister persister = GetEntityPersister(@event.Session.Factory, @event.EntityClassName);
					if (!persister.IsInstance(old, @event.Session.EntityMode))
					{
						return InconsistentRTNClassMarker;
					}
				}
				UpgradeLock(old, oldEntry, @event.LockMode, session);
			}
			return old;
		}
开发者ID:Mrding,项目名称:Ribbon,代码行数:44,代码来源:DefaultLoadEventListener.cs

示例14: LoadFromDatasource

		/// <summary>
		/// Performs the process of loading an entity from the configured underlying datasource.
		/// </summary>
		/// <param name="event">The load event </param>
		/// <param name="persister">The persister for the entity being requested for load </param>
		/// <param name="keyToLoad">The EntityKey representing the entity to be loaded. </param>
		/// <param name="options">The load options. </param>
		/// <returns> The object loaded from the datasource, or null if not found. </returns>
		protected virtual object LoadFromDatasource(LoadEvent @event, IEntityPersister persister, EntityKey keyToLoad, LoadType options)
		{
			ISessionImplementor source = @event.Session;

			bool statsEnabled = source.Factory.Statistics.IsStatisticsEnabled;
			var stopWath = new Stopwatch();
			if (statsEnabled)
			{
				stopWath.Start();
			}

			object entity = persister.Load(@event.EntityId, @event.InstanceToLoad, @event.LockMode, source);

			if (@event.IsAssociationFetch && statsEnabled)
			{
				stopWath.Stop();
				source.Factory.StatisticsImplementor.FetchEntity(@event.EntityClassName, stopWath.Elapsed);
			}

			return entity;
		}
开发者ID:Mrding,项目名称:Ribbon,代码行数:29,代码来源:DefaultLoadEventListener.cs

示例15: DoLoad

		/// <summary>
		/// Coordinates the efforts to load a given entity.  First, an attempt is
		/// made to load the entity from the session-level cache.  If not found there,
		/// an attempt is made to locate it in second-level cache.  Lastly, an
		/// attempt is made to load it directly from the datasource.
		/// </summary>
		/// <param name="event">The load event </param>
		/// <param name="persister">The persister for the entity being requested for load </param>
		/// <param name="keyToLoad">The EntityKey representing the entity to be loaded. </param>
		/// <param name="options">The load options. </param>
		/// <returns> The loaded entity, or null. </returns>
		protected virtual object DoLoad(LoadEvent @event, IEntityPersister persister, EntityKey keyToLoad, LoadType options)
		{
			if (log.IsDebugEnabled)
			{
				log.Debug("attempting to resolve: " + MessageHelper.InfoString(persister, @event.EntityId, @event.Session.Factory));
			}

			object entity = LoadFromSessionCache(@event, keyToLoad, options);
			if (entity == RemovedEntityMarker)
			{
				log.Debug("load request found matching entity in context, but it is scheduled for removal; returning null");
				return null;
			}
			if (entity == InconsistentRTNClassMarker)
			{
				log.Debug("load request found matching entity in context, but the matched entity was of an inconsistent return type; returning null");
				return null;
			}
			if (entity != null)
			{
				if (log.IsDebugEnabled)
				{
					log.Debug("resolved object in session cache: " + MessageHelper.InfoString(persister, @event.EntityId, @event.Session.Factory));
				}
				return entity;
			}

			entity = LoadFromSecondLevelCache(@event, persister, options);
			if (entity != null)
			{
				if (log.IsDebugEnabled)
				{
					log.Debug("resolved object in second-level cache: " + MessageHelper.InfoString(persister, @event.EntityId, @event.Session.Factory));
				}
				return entity;
			}

			if (log.IsDebugEnabled)
			{
				log.Debug("object not resolved in any cache: " + MessageHelper.InfoString(persister, @event.EntityId, @event.Session.Factory));
			}

			return LoadFromDatasource(@event, persister, keyToLoad, options);
		}
开发者ID:Mrding,项目名称:Ribbon,代码行数:55,代码来源:DefaultLoadEventListener.cs


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