public EdmTableProvider(EdmDataModelProvider dataModel, EntitySet entitySet, EntityType entityType, string name,
            bool isReadonly, bool supportPagingAndSorting)
            : base(dataModel)
        {
            _isReadonly = isReadonly;
            SupportPaging = supportPagingAndSorting;
            Name = name;
            DataContextPropertyName = entitySet.Name;
            EdmEntityType = entityType;

            var keyMembers = entityType.KeyMembers;

            // columns (entity properties)
            // note 1: keys are also available through es.ElementType.KeyMembers
            // note 2: this includes "nav properties", kind of fancy, two-way relationship objects
            var columns = new List<ColumnProvider>();
            foreach (EdmMember m in entityType.Members) {
                if (EdmColumnProvider.IsSupportedEdmMemberType(m)) {
                    var entityMember = new EdmColumnProvider(entityType, this, m, keyMembers.Contains(m), supportPagingAndSorting);
                    columns.Add(entityMember);
                }
            }

            _roColumns = new ReadOnlyCollection<ColumnProvider>(columns);
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            var model = new MetaModel();
            System.Threading.Interlocked.Increment(ref _modelCount);

            var provider = new EdmDataModelProvider(
                new Uri(TextBox1.Text.Trim()),
                isReadonly: !CheckBoxSupportEditing.Checked,
                supportPagingAndSorting: CheckBoxSupportPagingSorting.Checked);

            model.RegisterContext(
                provider,
                new ContextConfiguration() { ScaffoldAllTables = true });

            var routes = RouteTable.Routes;

            // TODO: remove stale routes!

            // The following statements support combined-page mode, where the List, Detail, Insert, and
            // Update tasks are performed by using the same page. To enable this mode, uncomment the
            // following routes and comment out the route definition in the separate-page mode section above.
            routes.Add(new DynamicDataRoute(String.Format("{0}/{{table}}/ListDetails.aspx", _modelCount)) {
                Action = PageAction.List,
                ViewName = "ListDetails",
                Model = model
            });

            routes.Add(new DynamicDataRoute(String.Format("{0}/{{table}}/ListDetails.aspx", _modelCount)) {
                Action = PageAction.Details,
                ViewName = "ListDetails",
                Model = model
            });

            Session["model"] = model;

            Response.Redirect("Default.aspx");
        }