private void ReadEntryStart() { ODataEntry entry = ReaderUtils.CreateNewEntry(); if (this.atomInputContext.MessageReaderSettings.ReaderBehavior.EntryXmlCustomizationCallback != null) { this.atomEntryAndFeedDeserializer.VerifyEntryStart(); Uri xmlBaseUri = this.atomInputContext.XmlReader.XmlBaseUri; XmlReader objB = this.atomInputContext.MessageReaderSettings.ReaderBehavior.EntryXmlCustomizationCallback(entry, this.atomInputContext.XmlReader, this.atomInputContext.XmlReader.ParentXmlBaseUri); if (objB != null) { if (object.ReferenceEquals(this.atomInputContext.XmlReader, objB)) { throw new ODataException(Microsoft.Data.OData.Strings.ODataAtomReader_EntryXmlCustomizationCallbackReturnedSameInstance); } this.atomInputContext.PushCustomReader(objB, xmlBaseUri); this.atomEntryAndFeedDeserializer = new ODataAtomEntryAndFeedDeserializer(this.atomInputContext); this.atomEntryAndFeedDeserializersStack.Push(this.atomEntryAndFeedDeserializer); } else { this.atomInputContext.PushCustomReader(this.atomInputContext.XmlReader, null); } } this.atomEntryAndFeedDeserializer.ReadEntryStart(entry); this.EnterScope(ODataReaderState.EntryStart, entry, base.CurrentEntityType); AtomScope currentScope = (AtomScope)base.CurrentScope; currentScope.DuplicatePropertyNamesChecker = this.atomInputContext.CreateDuplicatePropertyNamesChecker(); string entityTypeNameFromPayload = this.atomEntryAndFeedDeserializer.FindTypeName(); base.ApplyEntityTypeNameFromPayload(entityTypeNameFromPayload); if (base.CurrentFeedValidator != null) { base.CurrentFeedValidator.ValidateEntry(base.CurrentEntityType); } ODataEntityPropertyMappingCache cache = this.atomInputContext.Model.EnsureEpmCache(this.CurrentEntryState.EntityType, 0x7fffffff); if (cache != null) { currentScope.CachedEpm = cache; } if (this.atomEntryAndFeedDeserializer.XmlReader.IsEmptyElement) { this.CurrentEntryState.EntryElementEmpty = true; } else { this.atomEntryAndFeedDeserializer.XmlReader.Read(); if (this.atomInputContext.UseServerApiBehavior) { this.CurrentEntryState.FirstNavigationLinkDescriptor = null; } else { this.CurrentEntryState.FirstNavigationLinkDescriptor = this.atomEntryAndFeedDeserializer.ReadEntryContent(this.CurrentEntryState); } } }
public void AddFunctionShouldAddFunctionToEntry() { ODataEntry entry = ReaderUtils.CreateNewEntry(); entry.Functions.Count().Should().Be(0); entry.AddFunction(new ODataFunction()); entry.Functions.Count().Should().Be(1); }
public ODataMissingOperationGeneratorTests() { this.model = new EdmModel(); this.container = new EdmEntityContainer("Fake", "Container"); this.functionEdmMetadata = new EdmFunction("Fake", "FakeFunction", EdmCoreModel.Instance.GetInt32(false), true /*isBound*/, null, true /*isComposable*/); this.actionEdmMetadata = new EdmAction("Fake", "FakeAction", EdmCoreModel.Instance.GetInt32(false), true /*isBound*/, null /*entitySetPath*/); this.model.AddElement(this.container); this.model.AddElement(this.actionEdmMetadata); this.model.AddElement(this.functionEdmMetadata); this.allOperations = new EdmOperation[] { this.actionEdmMetadata, this.functionEdmMetadata }; this.odataAction = new ODataAction { Metadata = new Uri("http://temp.org/$metadata#Fake.FakeAction") }; this.odataFunction = new ODataFunction { Metadata = new Uri("http://temp.org/$metadata#Fake.FakeFunction") }; this.entry = ReaderUtils.CreateNewEntry(); this.entityType = new EdmEntityType("TestNamespace", "EntityType"); }
private void StartEntry() { this.EnterScope(ODataReaderState.EntryStart, ReaderUtils.CreateNewEntry(), base.CurrentEntityType); this.CurrentJsonScope.DuplicatePropertyNamesChecker = this.jsonInputContext.CreateDuplicatePropertyNamesChecker(); }
public void TestInit() { this.entry = ReaderUtils.CreateNewEntry(); this.entityType = new EdmEntityType("TestNamespace", "EntityType"); }