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

C# ChangeSet类代码示例

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

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



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

示例1: Post

        public OperationResult Post(string description, ChangeSet<ShoppingListItem> changes)
        {
            var item = this.GetItem(description);
            changes.Apply(item);

            return new OperationResult.SeeOther { RedirectLocation = item.CreateUri() };
        }
开发者ID:RobertTheGrey,项目名称:OpenRasta.Codecs.Spark,代码行数:7,代码来源:ShoppingListItemHandler.cs


示例2: Initialize

 public void Initialize()
 {
     ChangeSet = new ChangeSet();
     ChangeSet.AddInsert(new object());
     ChangeSet.AddUpdate(new object());
     ChangeSet.AddDelete(new object());
 }
开发者ID:RookieOne,项目名称:GreekFire,代码行数:7,代码来源:WhenReset.cs


示例3: GenerateChangeSet

 public static ChangeSet GenerateChangeSet(Config oldConfig, Config newConfig)
 {
     var cs = new ChangeSet();
     foreach (var n in oldConfig)
     {
         var oldKey = n.Key;
         if (newConfig.ContainsKey(oldKey))
         {
             var newNode = newConfig[oldKey];
             if (n.Value != newNode)
             {
                 cs.Add(new ConfigChange() { Type = ChangeType.Modified, Key = oldKey, Old = n.Value, New = newNode });
             }
         }
         else
         {
             cs.Add(new ConfigChange() { Type = ChangeType.Removed, Key = oldKey, Old = n.Value, New = null });
         }
     }
     foreach (var n in newConfig)
     {
         var newKey = n.Key;
         if (!oldConfig.ContainsKey(newKey))
         {
             cs.Add(new ConfigChange() { Type = ChangeType.Added, Key = newKey, Old = null, New = newConfig[newKey] });
         }
     }
     return cs;
 }
开发者ID:Team2122,项目名称:SpudConf,代码行数:29,代码来源:ConfigLoader.cs


示例4: ApplyChanges_EnumPropertyOnTypeChanged_PropertyInChangeSetIsChanged

        public void ApplyChanges_EnumPropertyOnTypeChanged_PropertyInChangeSetIsChanged()
        {
            const TestEnum testEnumValue = TestEnum.ValueOne;
            const int testIntegerValue = 42;
            const string testStringValue = "The quick brown fox jumped over the lazy dog.";
            var testIntegerEnumeration = new[] { 1, 2, 3, 4, 5 };

            const TestEnum changedEnumValue = TestEnum.ValueTwo;

            var testObject = new TestObject
            {
                TestEnum = testEnumValue,
                TestInteger = testIntegerValue,
                TestString = testStringValue,
                TestIntegerEnumeration = testIntegerEnumeration
            };

            dynamic changeSet = new ChangeSet<TestObject>();

            changeSet.TestEnum = changedEnumValue;

            changeSet.ApplyChanges(ref testObject);

            Assert.That(testObject, Is.Not.Null);
            Assert.That(testObject.TestEnum, Is.EqualTo(changedEnumValue));
            Assert.That(testObject.TestInteger, Is.EqualTo(testIntegerValue));
            Assert.That(testObject.TestString, Is.EqualTo(testStringValue));
        }
开发者ID:chrisblock,项目名称:Changes,代码行数:28,代码来源:ChangeSetTests.cs


示例5: GetSubmitResults

        /// <summary>
        /// Examine the list of operations after the service has finished, and determine what needs to
        /// be sent back to the client.
        /// </summary>
        /// <param name="changeSet">The change set processed.</param>
        /// <returns>The results list.</returns>
        private static List<ChangeSetEntry> GetSubmitResults(ChangeSet changeSet)
        {
            List<ChangeSetEntry> results = new List<ChangeSetEntry>();
            foreach (ChangeSetEntry changeSetEntry in changeSet.ChangeSetEntries)
            {
                results.Add(changeSetEntry);

                if (changeSetEntry.HasError)
                {
                    // if customErrors is turned on, clear out the stacktrace.
                    // This is an additional step here so that ValidationResultInfo
                    // and DomainService can remain agnostic to http-concepts
                    HttpContext context = HttpContext.Current;
                    if (context != null && context.IsCustomErrorEnabled)
                    {
                        if (changeSetEntry.ValidationErrors != null)
                        {
                            foreach (ValidationResultInfo error in changeSetEntry.ValidationErrors.Where(e => e.StackTrace != null))
                            {
                                error.StackTrace = null;
                            }
                        }
                    }
                }

                // Don't round-trip data that the client doesn't care about.
                changeSetEntry.Associations = null;
                changeSetEntry.EntityActions = null;
                changeSetEntry.OriginalAssociations = null;
                changeSetEntry.OriginalEntity = null;
            }

            return results;
        }
开发者ID:OpenRIAServices,项目名称:OpenRiaServices,代码行数:40,代码来源:ChangeSetProcessor.cs


示例6: advisoryBuilder_generateAdvisory_for_transient_and_changed_entity

		public void advisoryBuilder_generateAdvisory_for_transient_and_changed_entity()
		{
			var expectedAction = ProposedActions.Create;
			var entity = new Object();
			var entityState = EntityTrackingStates.IsTransient | EntityTrackingStates.AutoRemove | EntityTrackingStates.HasBackwardChanges;

			var c1 = MockRepository.GenerateStub<IChange>();
			c1.Expect( obj => obj.GetChangedEntities() ).Return( new Object[] { entity } );
			c1.Expect( obj => obj.GetAdvisedAction( entity ) ).Return( ProposedActions.Update | ProposedActions.Create );
			c1.Replay();

			var c2 = MockRepository.GenerateStub<IChange>();
			c2.Expect( obj => obj.GetChangedEntities() ).Return( new Object[] { entity } );
			c2.Expect( obj => obj.GetAdvisedAction( entity ) ).Return( ProposedActions.Update | ProposedActions.Create );
			c2.Replay();

			var cSet = new ChangeSet( new IChange[] { c1, c2 } );

			var svc = MockRepository.GenerateStub<IChangeTrackingService>();
			svc.Expect( obj => obj.GetEntityState( entity ) ).Return( entityState );
			svc.Expect( obj => obj.GetEntities( EntityTrackingStates.IsTransient, true ) ).Return( new Object[ 0 ] );
			svc.Replay();

			var actual = new AdvisoryBuilder( new ChangeSetDistinctVisitor() );
			IAdvisory advisory = actual.GenerateAdvisory( svc, cSet );

			advisory.Should().Not.Be.Null();
			advisory.Count.Should().Be.EqualTo( 1 );
			advisory.First().Action.Should().Be.EqualTo( expectedAction );
			advisory.First().Target.Should().Be.EqualTo( entity );
		}
开发者ID:nazarenomanco,项目名称:Radical,代码行数:31,代码来源:AdvisoryBuilderTests.cs


示例7: FormatMessage

        private string FormatMessage(ChangeSet change_set)
        {
            string message = "added ‘{0}’";

            switch (change_set.Changes[0].Type)
            {
                case CmisChangeType.Edited: message = "edited ‘{0}’"; break;
                case CmisChangeType.Deleted: message = "deleted ‘{0}’"; break;
                case CmisChangeType.Moved: message = "moved ‘{0}’"; break;
            }

            if (change_set.Changes.Count == 1)
            {
                return message = string.Format(message, change_set.Changes[0].Path);

            }
            else if (change_set.Changes.Count > 1)
            {
                return string.Format(message + " and {0} more", change_set.Changes.Count - 1);

            }
            else
            {
                return "did something magical";
            }
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:26,代码来源:BubblesController.cs


示例8: ApplyChanges_ChildrenOnTypeChanged_PropertyInChangeSetIsChanged

        public void ApplyChanges_ChildrenOnTypeChanged_PropertyInChangeSetIsChanged()
        {
            const TestEnum testEnumValue = TestEnum.ValueOne;
            const int testIntegerValue = 42;
            const string testStringValue = "The quick brown fox jumped over the lazy dog.";

            var testChildren = new[]
            {
                new TestObject()
            };

            var testObject = new TestObject
            {
                TestEnum = testEnumValue,
                TestInteger = testIntegerValue,
                TestString = testStringValue,
                Children = new TestObject[0]
            };

            dynamic changeSet = new ChangeSet<TestObject>();

            changeSet.Children = testChildren;

            changeSet.ApplyChanges(ref testObject);

            Assert.That(testObject, Is.Not.Null);
            Assert.That(testObject.TestEnum, Is.EqualTo(testEnumValue));
            Assert.That(testObject.TestInteger, Is.EqualTo(testIntegerValue));
            Assert.That(testObject.TestString, Is.EqualTo(testStringValue));
            Assert.That(testObject.Children, Is.EquivalentTo(testChildren));
        }
开发者ID:chrisblock,项目名称:Changes,代码行数:31,代码来源:ChangeSetTests.cs


示例9: FromXElement

        /// <summary>
        /// Converts a given <see cref="T:XElement"/> into a <see cref="T:ChangeSetHistory"/>.
        /// </summary>
        /// <param name="element">The <see cref="T:XElement"/> to convert.</param>
        /// <returns>The newly created <see cref="T:ChangeSetHistory"/>.</returns>
        public ChangeSetHistory FromXElement(XElement element)
        {
            ChangeSetHistory history = new ChangeSetHistory();
            foreach (XElement changeSetElement in element.Nodes()) {
                ChangeSet changeSet = new ChangeSet();

                // Get the change set details
                foreach (XElement changeSetElementChild in changeSetElement.Nodes()) {
                    if (changeSetElementChild.Name.LocalName == "Applied") {
                        changeSet.Applied = DateTime.Parse(changeSetElementChild.Value);
                    } else if (changeSetElementChild.Name.LocalName == "Username") {
                        changeSet.Username = changeSetElementChild.Value;
                    } else if (changeSetElementChild.Name.LocalName == "Change") {
                        Change change = new Change();
                        foreach (XElement changeElement in changeSetElementChild.Nodes()) {
                            if (changeElement.Name.LocalName == "PropertyName") {
                                change.PropertyName = changeElement.Value;
                            } else if (changeElement.Name.LocalName == "OldValue") {
                                change.OldValue = changeElement.Value;
                            } else if (changeElement.Name.LocalName == "NewValue") {
                                change.NewValue = changeElement.Value;
                            }
                        }
                        changeSet.Changes.Add(change);
                    }
                }
                history.Append(changeSet);
            }
            return history;
        }
开发者ID:PaulStovell,项目名称:trial-balance,代码行数:35,代码来源:ChangeSetHistoryXElementAdapter.cs


示例10: It_appends_substring_of_comment_and_ellipsis_as_title_if_it_is_longer_than_30_characters

        public void It_appends_substring_of_comment_and_ellipsis_as_title_if_it_is_longer_than_30_characters()
        {
            var changeSet = new ChangeSet(ChangeSetId.NewUniqueId(), null, "Comment longer than 30 characters", new AbstractCommand[] { });

            var model = CreateModel(changeSet);

            Assert.AreEqual("Comment longer than 30 char...", model.RootNodes[0].Title);
        }
开发者ID:SzymonPobiega,项目名称:ReferenceDataManager,代码行数:8,代码来源:ChangeSetTreeViewModelFactoryTests.cs


示例11: It_appends_comment_as_title_if_it_is_shorter_or_equal_to_30_characters

        public void It_appends_comment_as_title_if_it_is_shorter_or_equal_to_30_characters()
        {
            var changeSet = new ChangeSet(ChangeSetId.NewUniqueId(), null, "Comment with exactly  30 chars", new AbstractCommand[] { });

            var model = CreateModel(changeSet);

            Assert.AreEqual("Comment with exactly  30 chars", model.RootNodes[0].Title);
        }
开发者ID:SzymonPobiega,项目名称:ReferenceDataManager,代码行数:8,代码来源:ChangeSetTreeViewModelFactoryTests.cs


示例12: OnBeginCommit

		public override bool OnBeginCommit (ChangeSet changeSet)
		{
			// In this callback we check if the user information configured in Git
			// matches the user information configured in MonoDevelop. If the configurations
			// don't match, it shows a dialog asking the user what to do.
			
			GitRepository repo = (GitRepository) changeSet.Repository;
			
			Solution sol = null;
			// Locate the solution to which the changes belong
			foreach (Solution s in IdeApp.Workspace.GetAllSolutions ()) {
				if (s.BaseDirectory == changeSet.BaseLocalPath || changeSet.BaseLocalPath.IsChildPathOf (s.BaseDirectory)) {
					sol = s;
					break;
				}
			}
			if (sol == null)
				return true;
			
			string val = sol.UserProperties.GetValue<string> ("GitUserInfo");
			if (val == "UsingMD") {
				// If the solution is configured to use the MD configuration, make sure the Git config is up to date.
				string user;
				string email;
				repo.GetUserInfo (out user, out email);
				if (user != sol.AuthorInformation.Name || email != sol.AuthorInformation.Email)
					repo.SetUserInfo (sol.AuthorInformation.Name, sol.AuthorInformation.Email);
			}
			else if (val != "UsingGIT") {
				string user;
				string email;
				repo.GetUserInfo (out user, out email);
				if (user != sol.AuthorInformation.Name || email != sol.AuthorInformation.Email) {
					// There is a conflict. Ask the user what to do
					string gitInfo = GetDesc (user, email);
					string mdInfo = GetDesc (sol.AuthorInformation.Name, sol.AuthorInformation.Email);
					
					UserInfoConflictDialog dlg = new UserInfoConflictDialog (mdInfo, gitInfo);
					try {
						if (dlg.Run () == (int) Gtk.ResponseType.Ok) {
							if (dlg.UseMonoDevelopConfig) {
								repo.SetUserInfo (sol.AuthorInformation.Name, sol.AuthorInformation.Email);
								sol.UserProperties.SetValue ("GitUserInfo", "UsingMD");
							} else
								sol.UserProperties.SetValue ("GitUserInfo", "UsingGIT");
							sol.SaveUserProperties ();
						}
						else
							return false;
					} finally {
						dlg.Destroy ();
					}
				}
			}
			return true;
		}
开发者ID:pgoron,项目名称:monodevelop,代码行数:56,代码来源:CommitDialogExtensionWidget.cs


示例13: CreateNodeModel

 private static ChangeSetTreeNodeViewModel CreateNodeModel(ChangeSet changeSet, IEnumerable<ChangeSet> allChangeSets)
 {
     var children = allChangeSets.Where(x => x.ParentId == changeSet.Id);
     return new ChangeSetTreeNodeViewModel
                {
                    Id = changeSet.Id.ToString(),
                    Title = MakeTitle(changeSet),
                    Children = children.Select(x => CreateNodeModel(x, allChangeSets)).ToList()
                };
 }
开发者ID:SzymonPobiega,项目名称:ReferenceDataManager,代码行数:10,代码来源:ChangeSetTreeViewModelFactory.cs


示例14: Initialize

		public override bool Initialize (ChangeSet changeSet)
		{
			if (changeSet.Repository is GitRepository) {
				pushCheckbox = new Gtk.CheckButton (GettextCatalog.GetString ("Push changes to remote repository after commit"));
				Add (pushCheckbox);
				ShowAll ();
				return true;
			} else
				return false;
		}
开发者ID:pgoron,项目名称:monodevelop,代码行数:10,代码来源:CommitDialogExtensionWidget.cs


示例15: Equality

        public void Equality()
        {
            var a = new ChangeSet(new ChangeSetId(1, "123456"));
            Assert.Equal(a, a);

            var b = new ChangeSet(new ChangeSetId(1, "123456"));
            Assert.Equal(a, b);

            var c = new ChangeSet(new ChangeSetId(1, "789123"));
            Assert.NotEqual(a, c);
        }
开发者ID:naighes,项目名称:Modern.Hg,代码行数:11,代码来源:ChangeSetTests.cs


示例16: MeasurementCache

        public MeasurementCache(DatabaseTemplate template)
        {
            var values = new ChangeSet();
            template.binaries.EachIndex((m, i) => values.Update(new Binary(Flags.RESTART), Convert.ToUInt16(i)));
            template.doubleBinaries.EachIndex((m, i) => values.Update(new DoubleBitBinary(Flags.RESTART), Convert.ToUInt16(i)));
            template.counters.EachIndex((m, i) => values.Update(new Counter(Flags.RESTART), Convert.ToUInt16(i)));
            template.frozenCounters.EachIndex((m, i) => values.Update(new FrozenCounter(Flags.RESTART), Convert.ToUInt16(i)));
            template.analogs.EachIndex((m, i) => values.Update(new Analog(Flags.RESTART), Convert.ToUInt16(i)));
            template.binaryOutputStatii.EachIndex((m, i) => values.Update(new BinaryOutputStatus(Flags.RESTART), Convert.ToUInt16(i)));
            template.analogOutputStatii.EachIndex((m, i) => values.Update(new AnalogOutputStatus(Flags.RESTART), Convert.ToUInt16(i)));
            template.timeAndIntervals.EachIndex((m, i) => values.Update(new TimeAndInterval(0, 0, IntervalUnits.Undefined), Convert.ToUInt16(i)));

            this.Load(values);
        }
开发者ID:automatak,项目名称:dnp3-simulator,代码行数:14,代码来源:MeasurementCache.cs


示例17: Initialize

 public override bool Initialize(ChangeSet changeSet)
 {
     var repo = changeSet.Repository as TFSRepository;
     if (repo != null)
     {
         widget = new TFSCommitDialogExtensionWidget();
         this.Add(widget);
         widget.Show();
         this.Show();
         return true;
     }
     else
         return false;
 }
开发者ID:Indomitable,项目名称:monodevelop-tfs-addin,代码行数:14,代码来源:TFSCommitDialogExtension.cs


示例18: Initialize

 public override bool Initialize(ChangeSet changeSet)
 {
     if (changeSet.Repository is MercurialRepository) {
         widget = new MercurialCommitDialogExtensionWidget ();
         Add (widget);
         widget.Show ();
         Show ();
         widget.Changed += delegate {
             AllowCommit = widget.CommitterIsAuthor || widget.AuthorName.Length > 0;
         };
         return true;
     } else
         return false;
 }
开发者ID:atsushieno,项目名称:monodevelop-mercurial,代码行数:14,代码来源:MercurialCommitDialogExtension.cs


示例19: changeSet_ctor

		public void changeSet_ctor()
		{
			var expected = new IChange[] 
			{
				MockRepository.GenerateStub<IChange>(),
				MockRepository.GenerateStub<IChange>(),
				MockRepository.GenerateStub<IChange>()
			};

			var actual = new ChangeSet( expected );

			actual.Count.Should().Be.EqualTo( 3 );
			actual.Should().Have.SameSequenceAs( expected );
		}
开发者ID:nazarenomanco,项目名称:Radical,代码行数:14,代码来源:ChangeSetTests.cs


示例20: Initialize

		public override bool Initialize (ChangeSet changeSet)
		{
			var repo = changeSet.Repository as GitRepository;
			if (repo != null) {
				widget = new GitCommitDialogExtensionWidget (repo);
				Add (widget);
				widget.Show ();
				Show ();
				widget.Changed += delegate {
					AllowCommit = widget.CommitterIsAuthor || widget.AuthorName.Length > 0;
				};
				return true;
			}
			return false;
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:15,代码来源:GitCommitDialogExtension.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# ChangeTrackingCollection类代码示例发布时间:2022-05-24
下一篇:
C# ChangePasswordViewModel类代码示例发布时间: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