public void CollectionNamesCaseInsensitiveByDefault_ResolveCollectionVaryingCollectionNameCasing()
        {
            var entityDataModelBuilder = new EntityDataModelBuilder(StringComparer.OrdinalIgnoreCase);

            entityDataModelBuilder.RegisterEntitySet <Category>("Categories", x => x.Name);

            var entityDataModel = entityDataModelBuilder.BuildModel();

            Assert.Same(entityDataModel.EntitySets["categories"], entityDataModel.EntitySets["Categories"]);
        }
        public EntityDataModelTests()
        {
            EntityDataModelBuilder entityDataModelBuilder = new EntityDataModelBuilder(StringComparer.OrdinalIgnoreCase)
                                                            .RegisterEntitySet <Category>("Categories", x => x.Name, Capabilities.Insertable | Capabilities.Updatable | Capabilities.Deletable)
                                                            .RegisterEntitySet <Customer>("Customers", x => x.CompanyName, Capabilities.Updatable)
                                                            .RegisterEntitySet <Employee>("Employees", x => x.Id)
                                                            .RegisterEntitySet <Manager>("Managers", x => x.Id)
                                                            .RegisterEntitySet <Order>("Orders", x => x.OrderId, Capabilities.Insertable | Capabilities.Updatable)
                                                            .RegisterEntitySet <Product>("Products", x => x.ProductId, Capabilities.Insertable | Capabilities.Updatable);

            _entityDataModel = entityDataModelBuilder.BuildModel();
        }
            public WhenCalling_BuildModelWith_Models_AndCustomEntitySetName()
            {
                var entityDataModelBuilder = new EntityDataModelBuilder(StringComparer.OrdinalIgnoreCase);

                entityDataModelBuilder.RegisterEntitySet <Category>("Categories", x => x.Name, Capabilities.Insertable | Capabilities.Updatable | Capabilities.Deletable);
                entityDataModelBuilder.RegisterEntitySet <Customer>("Customers", x => x.CompanyName, Capabilities.Updatable);
                entityDataModelBuilder.RegisterEntitySet <Employee>("Employees", x => x.Id);
                entityDataModelBuilder.RegisterEntitySet <Manager>("Managers", x => x.Id);
                entityDataModelBuilder.RegisterEntitySet <Order>("Orders", x => x.OrderId, Capabilities.Insertable | Capabilities.Updatable);
                entityDataModelBuilder.RegisterEntitySet <Product>("Products", x => x.ProductId, Capabilities.Insertable | Capabilities.Updatable);

                this.entityDataModel = entityDataModelBuilder.BuildModel();
            }
            public WhenCalling_BuildModelWith_Models_AndTypeNameForEntitySetName()
            {
                var entityDataModelBuilder = new EntityDataModelBuilder(StringComparer.OrdinalIgnoreCase);

                entityDataModelBuilder.RegisterEntitySet <Category>(x => x.Name);
                entityDataModelBuilder.RegisterEntitySet <Customer>(x => x.CompanyName);
                entityDataModelBuilder.RegisterEntitySet <Employee>(x => x.Id);
                entityDataModelBuilder.RegisterEntitySet <Manager>(x => x.Id);
                entityDataModelBuilder.RegisterEntitySet <Order>(x => x.OrderId);
                entityDataModelBuilder.RegisterEntitySet <Product>(x => x.ProductId);

                this.entityDataModel = entityDataModelBuilder.BuildModel();
            }
        internal static void EnsureEDM()
        {
            var entityDataModelBuilder = new EntityDataModelBuilder(StringComparer.OrdinalIgnoreCase);

            entityDataModelBuilder.RegisterEntitySet <Category>("Categories", x => x.Name, Capabilities.Insertable | Capabilities.Updatable | Capabilities.Deletable);
            entityDataModelBuilder.RegisterEntitySet <Customer>("Customers", x => x.CompanyName, Capabilities.Updatable);
            entityDataModelBuilder.RegisterEntitySet <Employee>("Employees", x => x.Id);
            entityDataModelBuilder.RegisterEntitySet <Manager>("Managers", x => x.Id);
            entityDataModelBuilder.RegisterEntitySet <Order>("Orders", x => x.OrderId, Capabilities.Insertable | Capabilities.Updatable);
            entityDataModelBuilder.RegisterEntitySet <Product>("Products", x => x.ProductId, Capabilities.Insertable | Capabilities.Updatable);

            entityDataModelBuilder.BuildModel();
        }
        /// <summary>
        /// Use OData services with the specified Entity Data Model.
        /// </summary>
        /// <param name="configuration">The server configuration.</param>
        /// <param name="entityDataModelBuilderCallback">The call-back to configure the Entity Data Model.</param>
        /// <param name="entitySetNameComparer">The comparer to use for the entty set name matching.</param>
        public static void UseOData(
            this HttpConfiguration configuration,
            Action <EntityDataModelBuilder> entityDataModelBuilderCallback,
            IEqualityComparer <string> entitySetNameComparer)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            if (entityDataModelBuilderCallback == null)
            {
                throw new ArgumentNullException(nameof(entityDataModelBuilderCallback));
            }

            configuration.Filters.Add(new ODataExceptionFilterAttribute());
            configuration.Filters.Add(new ODataVersionHeaderValidationAttribute());

            var entityDataModelBuilder = new EntityDataModelBuilder(entitySetNameComparer);

            entityDataModelBuilderCallback(entityDataModelBuilder);
            entityDataModelBuilder.BuildModel();
        }