var model = new EdmModel(); var entityType = new EdmEntityType("Namespace", "Entity"); model.AddElement(entityType); // This will pass model.AssertHasEntityType("Entity"); // This will throw an exception model.AssertHasEntityType("NonExistingEntity");
var model = new EdmModel(); // This will throw an exception because there are no entity types in the model model.AssertHasEntityType("Entity");In this example, we create a new EdmModel with no entity types. We then use the AssertHasEntityType method to check if the model has an entity type with the name "Entity", which will throw an exception because there are no entity types in the model. Package library: Microsoft.OData.Edm.