예제 #1
0
 public bool Equals(ExampleObject other)
 {
     if (ReferenceEquals(other, null))
     {
         return(false);
     }
     return(other.Id == Id);
 }
예제 #2
0
        public async Task SavingObject_ThatOverridesEqualsAndGetHashCodeMethods_SavesSuccessfully()
        {
            SetupContextWithRequestPipelineForSaving(
                new DataServiceContext[] { DefaultTrackingContext }, Response, "http://localhost:8000/ExampleObjects(1)");
            var exampleObject = new ExampleObject
            {
                Id   = 0,
                Name = "Example1"
            };

            DefaultTrackingContext.AddObject("ExampleObjects", exampleObject);
            Assert.NotNull(DefaultTrackingContext.GetEntityDescriptor(exampleObject));
            await SaveContextChangesAsync(new DataServiceContext[] { DefaultTrackingContext });
        }