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


C# ChangeSet类代码示例

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


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


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