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


C# IDataContext.Contains方法代码示例

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


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

示例1: Start

        public virtual void Start(IDataContext context = null)
        {
            Initialize();
            context = context.ToNonReadOnly();
            if (!context.Contains(NavigationConstants.IsDialog))
                context.Add(NavigationConstants.IsDialog, false);
            var app = MvvmApplication.Current;
            var viewModelType = app.GetStartViewModelType();

            var mappingProvider = app.IocContainer.Get<IViewMappingProvider>();
            IViewMappingItem mapping = mappingProvider.FindMappingForViewModel(viewModelType, context.GetData(NavigationConstants.ViewName), true);
            if (typeof(Page).IsAssignableFrom(mapping.ViewType))
            {
                _rootWindow = CreateNavigationWindow();
                var service = CreateNavigationService(_rootWindow);
                app.IocContainer.BindToConstant(service);
            }
            app.IocContainer.Get<IViewModelPresenter>().DynamicPresenters.Add(this);
            app.Start(context);
        }
开发者ID:dbeattie71,项目名称:MugenMvvmToolkit,代码行数:20,代码来源:WpfBootstrapperBase.cs

示例2: Parse

 public IList<IDataContext> Parse(object target, string bindingExpression, IList<object> sources, IDataContext context)
 {
     Should.NotBeNull(bindingExpression, nameof(bindingExpression));
     if (context == null)
         context = DataContext.Empty;
     KeyValuePair<KeyValuePair<string, int>, Action<IDataContext>[]>[] bindingValues;
     lock (_cache)
     {
         if (!_cache.TryGetValue(bindingExpression, out bindingValues))
         {
             try
             {
                 if (ReferenceEquals(context, DataContext.Empty))
                     context = _defaultContext;
                 context.AddOrUpdate(BindingBuilderConstants.Target, target);
                 _context = context;
                 _expression = Handle(bindingExpression, context);
                 _tokenizer = CreateTokenizer(Expression);
                 _memberVisitor.Context = context;
                 var value = ParseInternal()
                     .Select((pair, i) => new KeyValuePair<KeyValuePair<string, int>, Action<IDataContext>[]>(new KeyValuePair<string, int>(pair.Key, i), pair.Value))
                     .ToList();
                 value.Sort(MemberComparison);
                 bindingValues = value.ToArray();
                 if (!context.Contains(BindingBuilderConstants.NoCache))
                     _cache[bindingExpression] = bindingValues;
             }
             finally
             {
                 if (ReferenceEquals(_defaultContext, context))
                     _defaultContext.Clear();
                 _tokenizer = null;
                 _expression = null;
                 _context = null;
                 _memberVisitor.Context = null;
             }
         }
     }
     var result = new IDataContext[bindingValues.Length];
     if (sources != null && sources.Count > 0)
     {
         for (int i = 0; i < bindingValues.Length; i++)
         {
             var pair = bindingValues[i];
             var dataContext = new DataContext(context);
             dataContext.AddOrUpdate(BindingBuilderConstants.Target, target);
             if (pair.Key.Value < sources.Count)
             {
                 object src = sources[pair.Key.Value];
                 if (src != null)
                     dataContext.Add(BindingBuilderConstants.Source, src);
             }
             var actions = pair.Value;
             for (int j = 0; j < actions.Length; j++)
                 actions[j].Invoke(dataContext);
             result[i] = dataContext;
         }
     }
     else
     {
         for (int i = 0; i < bindingValues.Length; i++)
         {
             var actions = bindingValues[i].Value;
             var dataContext = new DataContext(context);
             dataContext.AddOrUpdate(BindingBuilderConstants.Target, target);
             for (int j = 0; j < actions.Length; j++)
                 actions[j].Invoke(dataContext);
             result[i] = dataContext;
         }
     }
     return result;
 }
开发者ID:dbeattie71,项目名称:MugenMvvmToolkit,代码行数:72,代码来源:BindingParser.cs

示例3: Start

 public virtual void Start(IDataContext context = null)
 {
     Initialize();
     context = context.ToNonReadOnly();
     if (!context.Contains(NavigationConstants.IsDialog))
         context.Add(NavigationConstants.IsDialog, false);
     var app = MvvmApplication.Current;
     app.IocContainer.Get<IViewModelPresenter>().DynamicPresenters.Add(this);
     app.Start(context);
 }
开发者ID:dbeattie71,项目名称:MugenMvvmToolkit,代码行数:10,代码来源:WinFormsBootstrapperBase.cs

示例4: CreateBuilder

 public IBindingBuilder CreateBuilder(IDataContext context = null)
 {
     context = context.ToNonReadOnly();
     if (!context.Contains(BindingBuilderConstants.BuildDelegate))
         context.Add(BindingBuilderConstants.BuildDelegate, _buildDelegate);
     return new BindingBuilder(context);
 }
开发者ID:sami1971,项目名称:MugenMvvmToolkit,代码行数:7,代码来源:BindingProvider.cs

示例5: btnDelete_Click

        private void btnDelete_Click(object sender, EventArgs e)
        {
            IList<Ocena> selItems = getDataGridViewUserControl()
                .getSelectedItems<Ocena>();
            if (selItems.Count != 1)
                return;

            Ocena ocena = selItems[0];
            string msg = String.Format(
                "Da li zelite da izbrisete ocenu za gimnasticara '{0}', za spravu '{1}'?",
                ocena.Gimnasticar.ImeSrednjeImePrezime, Sprave.toString(ActiveSprava));
            if (!MessageDialogs.queryConfirmation(msg, this.Text))
                return;

            Cursor.Current = Cursors.WaitCursor;
            Cursor.Show();
            try
            {
                try
                {
                    DataAccessProviderFactory factory = new DataAccessProviderFactory();
                    dataContext = factory.GetDataContext();
                    dataContext.BeginTransaction();

                    dataContext.Delete(ocena);

                    IList<RezultatskoTakmicenje> rezTakmicenja = loadRezTakmicenja(ocena.Gimnasticar);
                    foreach (RezultatskoTakmicenje rezTak in rezTakmicenja)
                    {
                        if (deoTakKod == DeoTakmicenjaKod.Takmicenje1)
                        {
                            rezTak.Takmicenje1.ocenaDeleted(ocena, rezTak);
                            dataContext.Save(rezTak.Takmicenje1);
                        }
                        else if (deoTakKod == DeoTakmicenjaKod.Takmicenje2)
                        {
                            if (rezTak.Propozicije.OdvojenoTak2)
                            {
                                rezTak.Takmicenje2.ocenaDeleted(ocena, rezTak);
                                dataContext.Save(rezTak.Takmicenje2);
                            }
                        }
                        else if (deoTakKod == DeoTakmicenjaKod.Takmicenje3)
                        {
                            if (rezTak.Propozicije.OdvojenoTak3)
                            {
                                rezTak.Takmicenje3.ocenaDeleted(ocena, rezTak);
                                dataContext.Save(rezTak.Takmicenje3);
                            }
                        }
                        else if (deoTakKod == DeoTakmicenjaKod.Takmicenje4)
                        {
                            if (rezTak.Propozicije.OdvojenoTak4)
                            {
                                rezTak.Takmicenje4.ocenaDeleted(ocena, rezTak);
                                dataContext.Save(rezTak.Takmicenje4);
                            }
                        }
                    }

                    foreach (RezultatskoTakmicenje rezTak in rezTakmicenja)
                    {
                        if (deoTakKod == DeoTakmicenjaKod.Takmicenje1)
                        {
                            foreach (GimnasticarUcesnik g in rezTak.Takmicenje1.Gimnasticari)
                                dataContext.Evict(g);
                        }
                        else if (deoTakKod == DeoTakmicenjaKod.Takmicenje2)
                        {
                            foreach (UcesnikTakmicenja2 u in rezTak.Takmicenje2.Ucesnici)
                            {
                                if (dataContext.Contains(u.Gimnasticar))
                                    dataContext.Evict(u.Gimnasticar);
                                dataContext.Evict(u);
                            }
                        }
                        else if (deoTakKod == DeoTakmicenjaKod.Takmicenje3)
                        {
                            foreach (UcesnikTakmicenja3 u in rezTak.Takmicenje3.Ucesnici)
                            {
                                if (dataContext.Contains(u.Gimnasticar))
                                    dataContext.Evict(u.Gimnasticar);
                                dataContext.Evict(u);
                            }
                        }
                    }

                    dataContext.Commit();
                }
                catch (Exception ex)
                {
                    if (dataContext != null && dataContext.IsInTransaction)
                        dataContext.Rollback();
                    MessageDialogs.showError(Strings.getFullDatabaseAccessExceptionMessage(ex), this.Text);
                    Close();
                    return;
                }
                finally
                {
                    if (dataContext != null)
//.........这里部分代码省略.........
开发者ID:stankela,项目名称:bilten,代码行数:101,代码来源:OceneForm.cs


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