• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# DataLoadOptions类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: OnCreated

 partial void OnCreated()
 {
     DataLoadOptions opts = new DataLoadOptions();
     opts.LoadWith<Room>(r => r.Computers);
     
     LoadOptions = opts;
 }
开发者ID:supermuk,项目名称:iudico,代码行数:7,代码来源:SecurityDataContext.cs


示例2: btnSubmit_Click

        /// <summary>
        /// Update profile
        /// </summary>
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            using (var context = new PetShopDataContext())
            {
                var options = new DataLoadOptions();
                options.LoadWith<Profile>(p => p.AccountList);
                context.LoadOptions = options;

                var profile = context.Profile.GetProfile(User.Identity.Name);

                if (!string.IsNullOrEmpty(profile.Username) && AddressForm.IsValid)
                {
                    if (profile.AccountList.Count > 0)
                    {
                        Account account = profile.AccountList[0];
                        UpdateAccount(ref account, AddressForm.Address);
                    }
                    else
                    {
                        var account = new Account();
                        profile.AccountList.Add(account);
                        account.UniqueID = profile.UniqueID;

                        UpdateAccount(ref account, AddressForm.Address);
                    }

                    context.SubmitChanges();
                }
            }
            lblMessage.Text = "Your profile information has been successfully updated.<br>&nbsp;";
        }
开发者ID:codesmithtools,项目名称:Framework-Samples,代码行数:34,代码来源:UserProfile.aspx.cs


示例3: ExecuteQueryLoadWith

        public void ExecuteQueryLoadWith()
        {
            var db = new TrackerDataContext { Log = Console.Out };
            db.DeferredLoadingEnabled = false;
            db.ObjectTrackingEnabled = false;

            DataLoadOptions options = new DataLoadOptions();
            options.LoadWith<Task>(t => t.CreatedUser);

            db.LoadOptions = options;

            var q1 = db.User
                .ByEmailAddress("[email protected]");

            var q2 = db.Task
                .Where(t => t.LastModifiedBy == "[email protected]");

            var result = db.ExecuteQuery(q1, q2);

            Assert.IsNotNull(result);

            var userResult = result.GetResult<User>();
            Assert.IsNotNull(userResult);

            var users = userResult.ToList();
            Assert.IsNotNull(users);

            var taskResult = result.GetResult<Task>();
            Assert.IsNotNull(taskResult);

            var tasks = taskResult.ToList();
            Assert.IsNotNull(tasks);
        }
开发者ID:codesmithtools,项目名称:Framework-Samples,代码行数:33,代码来源:DebugTest.cs


示例4: PostRepoInit

 public override void PostRepoInit()
 {
     var options = new DataLoadOptions();
     options.LoadWith<Sat>(s => s.User);
     options.LoadWith<User>(u => u.Tags);
     _repo.LoadOptions = options;
 }
开发者ID:ajglover,项目名称:helloapp,代码行数:7,代码来源:EventController.cs


示例5: GetAthleteClubByTournament

        public Inti_AthleteClub GetAthleteClubByTournament(Guid athleteId, Guid tournamentId)
        {
            using (var db = new IntiDataContext(_connectionString))
            {
                var dlo = new DataLoadOptions();
                dlo.LoadWith<Inti_AthleteClub>(ac => ac.Inti_Club);
                dlo.LoadWith<Inti_AthleteClub>(ac => ac.Inti_Position);
                dlo.LoadWith<Inti_AthleteClub>(ac => ac.Inti_Athlete);
                db.LoadOptions = dlo;

                var athleteClubs = from ac in db.Inti_AthleteClub
                                   where ac.AthleteGUID == athleteId &&
                                         ac.Inti_Club.TournamentGUID == tournamentId
                                   select ac;

                if(athleteClubs.ToList().Count == 1)
                {
                    var athleteClub = athleteClubs.ToList()[0];

                    return athleteClub;
                }

                if (athleteClubs.ToList().Count > 1)
                {
                    throw new ArgumentException("More than one club for the athlete with id {0} in the same tournament.", athleteId.ToString());
                }
            }

            return null;
        }
开发者ID:supersalad,项目名称:Interntipset,代码行数:30,代码来源:AthleteManagement.cs


示例6: GetAlgorithms

    public IEnumerable<DataTransfer.Algorithm> GetAlgorithms(string platformName) {
      roleVerifier.AuthenticateForAnyRole(OKBRoles.OKBAdministrator, OKBRoles.OKBUser);

      using (OKBDataContext okb = new OKBDataContext()) {
        DataLoadOptions dlo = new DataLoadOptions();
        dlo.LoadWith<Algorithm>(x => x.AlgorithmClass);
        dlo.LoadWith<Algorithm>(x => x.DataType);
        dlo.LoadWith<Algorithm>(x => x.AlgorithmUsers);
        okb.LoadOptions = dlo;

        var query = okb.Algorithms.Where(x => x.Platform.Name == platformName);
        List<Algorithm> results = new List<Algorithm>();

        if (roleVerifier.IsInRole(OKBRoles.OKBAdministrator)) {
          results.AddRange(query);
        } else {
          foreach (var alg in query) {
            if (alg.AlgorithmUsers.Count() == 0 || userManager.VerifyUser(userManager.CurrentUserId, alg.AlgorithmUsers.Select(y => y.UserGroupId).ToList())) {
              results.Add(alg);
            }
          }
        }
        return results.Select(x => Convert.ToDto(x)).ToArray();
      }
    }
开发者ID:t-h-e,项目名称:HeuristicLab,代码行数:25,代码来源:RunCreationService.cs


示例7: Command_Should_Parse_Correctly

        //[TestMethod()]
        public void Command_Should_Parse_Correctly()
        {
            // ARRANGE
            Character toon = null;
            InventoryItem invItem = new InventoryItem();

            // Get the client's character info
            string charName = "Badass";
            DataLoadOptions dlo = new DataLoadOptions();
            dlo.LoadWith<Character>(c => c.Account);
            dlo.LoadWith<Character>(c => c.Zone);
            dlo.LoadWith<Character>(c => c.InventoryItems);
            dlo.LoadWith<InventoryItem>(ii => ii.Item);
            using (EmuDataContext dbCtx = new EmuDataContext()) {
                dbCtx.ObjectTrackingEnabled = false;
                dbCtx.LoadOptions = dlo;
                toon = dbCtx.Characters.SingleOrDefault(c => c.Name == charName);
            }

            ZonePlayer zp = new ZonePlayer(1, toon, 1, new Client(new System.Net.IPEndPoint(0x2414188f, 123)));

            // ACT
            //zp.MsgMgr.ReceiveChannelMessage("someTarget", "!damage /amount:200 /type:3", 8, 0, 100);
            zp.MsgMgr.ReceiveChannelMessage("someTarget", "!damage", 8, 0, 100);

            // ASSERT
        }
开发者ID:natedahl32,项目名称:EqEmulator-net,代码行数:28,代码来源:ZonePlayerTest.cs


示例8: GetServerData

        private IEnumerable GetServerData(GridCommand command)
        {
            DataLoadOptions loadOptions = new DataLoadOptions();
            loadOptions.LoadWith<Order>(o => o.Customer);

            var dataContext = new NorthwindDataContext
            {
                LoadOptions = loadOptions
            };

            IQueryable<Order> data = dataContext.Orders;

            //Apply filtering
            data = data.ApplyFiltering(command.FilterDescriptors);

            ViewData["Total"] = data.Count();

            //Apply sorting
            data = data.ApplySorting(command.GroupDescriptors, command.SortDescriptors);

            //Apply paging
            data = data.ApplyPaging(command.Page, command.PageSize);

            //Apply grouping
            if (command.GroupDescriptors.Any())
            {
                return data.ApplyGrouping(command.GroupDescriptors);
            }
            return data.ToList();
        }
开发者ID:vialpando09,项目名称:RallyPortal2,代码行数:30,代码来源:CustomServerBindingController.cs


示例9: Main

        static void Main(string[] args)
        {
            NorthwindDataContext context = new NorthwindDataContext();
            //var result = from item in context.Categories
            //             where item.CategoryID == 48090
            //             select item;
            var result = context.SelectCategory(48090);
            foreach (var item in result)
            {
                Console.WriteLine("{0} {1}", item.CategoryID, item.CategoryName);
            }

            //context.DeferredLoadingEnabled = false;
            var ldOptions = new DataLoadOptions();
            ldOptions.AssociateWith<Category>((c) => (c.Products));
            context.LoadOptions = ldOptions;
            context.ObjectTrackingEnabled = false; // turns DeferredLoadingEnabled to false
            var result1 = context.Categories.Where((prod) => (prod.CategoryID == 65985)).Single();
            foreach (var item in result1.Products)
            {
                Console.WriteLine("{0} {1}",item.ProductID, item.ProductName);
            }

            Console.WriteLine();
            Compile();
            //Query2();
            //DirectExe();
            //Modify();
            //Trans();
            //MyDel();
            //Track();
            CreateDB();
            Console.ReadLine();
        }
开发者ID:naynishchaughule,项目名称:CSharp,代码行数:34,代码来源:Program.cs


示例10: Get

        public IPhishDatabase Get()
        {
            if (_database == null)
            {
                DataLoadOptions options = new DataLoadOptions();

                //options.LoadWith<Tour>(tour => tour.Shows);

                //options.LoadWith<Show>(show => show.Sets);

                //options.LoadWith<Set>(set => set.SetSongs);
                //options.LoadWith<Set>(set => set.Show);

                //options.LoadWith<SetSong>(setSong => setSong.Song);
                //options.LoadWith<SetSong>(setSong => setSong.Set);
                

                //options.LoadWith<Song>(song => song.set

                _database = new PhishDatabase(_connectionString) 
                    { 
                        LoadOptions = options, 
                        DeferredLoadingEnabled = true, 
                        Log = (_logWriter == null ? null : _logWriter.Get()) 
                    };
            }

            return _database;
        }
开发者ID:coredweller,项目名称:PhishMarket,代码行数:29,代码来源:PhishDatabaseFactory.cs


示例11: Details

        public ActionResult Details(int id)
        {
            IPFinalDBDataContext finalDB = new IPFinalDBDataContext();

            DataLoadOptions ds = new DataLoadOptions();
            ds.LoadWith<Work_Package>(wp => wp.Package_Softwares);
            ds.LoadWith<Package_Software>(ps => ps.Software_Requirement);
            finalDB.LoadOptions = ds;

            var pack = (from p in finalDB.Work_Packages
                        where p.id == id
                        select p).Single();

            //var data = from sr in finalDB.Software_Requirements
            //           join ps in finalDB.Package_Softwares
            //           on sr.id equals ps.sr_id
            //           where ps.wp_id == id
            //           select sr;

            //foreach (var ps in data)
            //{
            //    pack.Package_Softwares.Add(new Package_Software()
            //    {
            //        Software_Requirement = ps,
            //        Work_Package = pack
            //    });
            //}

            return View(pack);
        }
开发者ID:Ider,项目名称:SU-Courses,代码行数:30,代码来源:PackageController.cs


示例12: UserManager

 /// <summary>
 /// User Manager 
 /// </summary>
 public UserManager()
 {
     db = new BizzyQuoteDataContext(Properties.Settings.Default.BizzyQuoteConnectionString);
     var options = new DataLoadOptions();
     options.LoadWith<User>(u => u.Company);
     db.LoadOptions = options;
 }
开发者ID:BizzyQuote,项目名称:BQ2013,代码行数:10,代码来源:UserManager.cs


示例13: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         int personId = 0;
         if (Request.QueryString["id"] != null && int.TryParse(TamperProofString.QueryStringDecode(Request.QueryString["id"]), out personId))
         {
             Ajancy.Kimia_Ajancy db = new Ajancy.Kimia_Ajancy(Public.ConnectionString);
             DataLoadOptions dlo = new DataLoadOptions();
             dlo.LoadWith<Ajancy.Person>(p => p.DrivingLicenses);
             dlo.LoadWith<Ajancy.Person>(p => p.DriverCertifications);
             dlo.LoadWith<Ajancy.DriverCertification>(dc => dc.DriverCertificationCars);
             dlo.LoadWith<Ajancy.DriverCertificationCar>(dcc => dcc.CarPlateNumber);
             dlo.LoadWith<Ajancy.CarPlateNumber>(cpn => cpn.PlateNumber);
             dlo.LoadWith<Ajancy.CarPlateNumber>(cpn => cpn.Car);
             dlo.LoadWith<Ajancy.Car>(c => c.FuelCards);
             dlo.LoadWith<Ajancy.Car>(c => c.CarType);
             db.LoadOptions = dlo;
             SetPerson(db.Persons.FirstOrDefault<Ajancy.Person>(p => p.PersonID == personId));
             db.Dispose();
         }
         else
         {
             Response.Redirect("~/Default.aspx");
         }
     }
 }
开发者ID:BehnamAbdy,项目名称:Ajancy,代码行数:27,代码来源:DriverInfo.aspx.cs


示例14: Save

        public void Save(params ContentType[] contentTypes)
        {
            using (var ts = new TransactionScope())
            using (var dataContext = new ContentDataContext(connectionString))
            {
                var loadOptions = new DataLoadOptions();
                loadOptions.LoadWith<ContentTypeItem>(ct => ct.ContentActionItems);

                dataContext.LoadOptions = loadOptions;

                var contentTypeItems = dataContext.ContentTypeItems.ToList();
                var itemsToDelete = from data in contentTypeItems
                                    where !contentTypes.Any(t => t.Type == data.Type && t.ControllerName == data.ControllerName)
                                    select data;

                var itemsToUpdate = (from data in contentTypeItems
                                     let type = contentTypes.SingleOrDefault(t => t.Type == data.Type && t.ControllerName == data.ControllerName)
                                     where type != null
                                     select new { data, type }).ToList();

                var itemsToInsert = (from type in contentTypes
                                     where !contentTypeItems.Any(t => t.Type == type.Type && t.ControllerName == type.ControllerName)
                                     select CreateContentTypeItem(type)).ToList();

                itemsToUpdate.ForEach(i => UpdateContentTypeItem(i.data, i.type, dataContext));

                dataContext.ContentTypeItems.DeleteAllOnSubmit(itemsToDelete);
                dataContext.ContentTypeItems.InsertAllOnSubmit(itemsToInsert);

                dataContext.SubmitChanges();
                ts.Complete();
            }
        }
开发者ID:burkhartt,项目名称:Bennington,代码行数:33,代码来源:SqlContentTypeRegistry.cs


示例15: GetDefaultDataLoadOptions

 private static DataLoadOptions GetDefaultDataLoadOptions()
 {
     var lo = new DataLoadOptions();
     lo.LoadWith<Document>(c => c.Employee);
     lo.LoadWith<Document>(c => c.Employee1);
     lo.LoadWith<DocumentTransitionHistory>(c=>c.Employee);
     return lo;
 }
开发者ID:jiguixin,项目名称:WF,代码行数:8,代码来源:DocumentHelper.cs


示例16: TaskRepository

 public TaskRepository()
 {
     _dataContext = new DataContextDataContext();
     DataLoadOptions dlo = new DataLoadOptions();
     dlo.LoadWith<Task>(t => t.Project);
     dlo.LoadWith<Task>(t => t.Priority);
     _dataContext.LoadOptions = dlo;
 }
开发者ID:stuartleyland,项目名称:GreenPadMvvm,代码行数:8,代码来源:TaskRepository.cs


示例17: AddFactory

		internal void AddFactory(Type elementType, Type dataReaderType, object mapping, DataLoadOptions options, SqlExpression projection, IObjectReaderFactory factory)
		{
			this.list.AddFirst(new LinkedListNode<CacheInfo>(new CacheInfo(elementType, dataReaderType, mapping, options, projection, factory)));
			if(this.list.Count > this.maxCacheSize)
			{
				this.list.RemoveLast();
			}
		}
开发者ID:modulexcite,项目名称:LinqToSQL2,代码行数:8,代码来源:ObjectReaderFactoryCache.cs


示例18: GetDefaultDataLoadOptions

 private static DataLoadOptions GetDefaultDataLoadOptions()
 {
     var lo = new DataLoadOptions();
     lo.LoadWith<Employee>(c => c.StructDivision);
     lo.LoadWith<EmployeeRole>(c => c.Role);
     lo.LoadWith<Employee>(c => c.EmployeeRoles);
     return lo;
 }
开发者ID:kanpinar,项目名称:unity3.1th,代码行数:8,代码来源:EmployeeHelper.cs


示例19: Repository

        public Repository(string strConnection)
        {
            m_ctx = new DataContext(strConnection);

            DataLoadOptions dlo = new DataLoadOptions();
            dlo.LoadWith<Artist>(c => c.Genre);
            m_ctx.LoadOptions = dlo;
        }
开发者ID:triggerfish,项目名称:Blog-DbProvider,代码行数:8,代码来源:Repository.cs


示例20: QuoteManager

 /// <summary>
 /// Quote Manager 
 /// </summary>
 public QuoteManager()
 {
     db = new BizzyQuoteDataContext(Properties.Settings.Default.BizzyQuoteConnectionString);
     var options = new DataLoadOptions();
     options.LoadWith<Quote>(q => q.QuoteItems);
     options.LoadWith<QuoteItem>(qi => qi.Material);
     options.LoadWith<QuoteItem>(qi => qi.Product);
     db.LoadOptions = options;
 }
开发者ID:BizzyQuote,项目名称:BQ2013,代码行数:12,代码来源:QuoteManager.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DataManager类代码示例发布时间:2022-05-24
下一篇:
C# DataListItemEventArgs类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap