// Returns the base types, this type and all the derived types of this type.
        public static IEnumerable <EntityTypeConfiguration> ThisAndBaseAndDerivedTypes(this ODataModelBuilder modelBuilder, EntityTypeConfiguration entity)
        {
            Contract.Assert(modelBuilder != null);
            Contract.Assert(entity != null);

            return(entity.BaseTypes()
                   .Concat(new[] { entity })
                   .Concat(modelBuilder.DerivedTypes(entity)));
        }
        // Returns the base types, this type and all the derived types of this type.
        public static IEnumerable<EntityTypeConfiguration> ThisAndBaseAndDerivedTypes(this ODataModelBuilder modelBuilder, EntityTypeConfiguration entity)
        {
            Contract.Assert(modelBuilder != null);
            Contract.Assert(entity != null);

            return entity.BaseTypes()
                    .Concat(new[] { entity })
                    .Concat(modelBuilder.DerivedTypes(entity));
        }
        public void BaseTypes_Works()
        {
            ODataModelBuilder builder = GetMockVehicleModel();

            EntityTypeConfiguration vehicle    = builder.StructuralTypes.OfType <EntityTypeConfiguration>().Where(e => e.Name == "vehicle").Single();
            EntityTypeConfiguration motorcycle = builder.StructuralTypes.OfType <EntityTypeConfiguration>().Where(e => e.Name == "motorcycle").Single();
            EntityTypeConfiguration sportbike  = builder.StructuralTypes.OfType <EntityTypeConfiguration>().Where(e => e.Name == "sportbike").Single();

            Assert.Equal(
                sportbike.BaseTypes().Select(e => e.Name).OrderBy(name => name),
                new[] { vehicle, motorcycle }.Select(e => e.Name).OrderBy(name => name));
        }
 // Returns the base types, this type.
 public static IEnumerable <EntityTypeConfiguration> ThisAndBaseTypes(this EntityTypeConfiguration entity)
 {
     Contract.Assert(entity != null);
     return(entity.BaseTypes().Concat(new[] { entity }));
 }