• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# DynamicData.MetaTable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Web.DynamicData.MetaTable的典型用法代码示例。如果您正苦于以下问题:C# MetaTable类的具体用法?C# MetaTable怎么用?C# MetaTable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MetaTable类属于System.Web.DynamicData命名空间,在下文中一共展示了MetaTable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: FieldGenerator

        // Methods
        public FieldGenerator( MetaTable table, Control dataBoundControl, DataBoundControlMode mode )
        {
            this._table = table;
            this._dataBoundControl = dataBoundControl;
            this._mode = mode;

            List<MetaColumn> columns = new List<MetaColumn>( _table.Columns );

            //упорядочить колонки в порядке следования в мета-классе.
            var metadataTypeAttribute = (MetadataTypeAttribute)Attribute.GetCustomAttribute( _table.EntityType, typeof( MetadataTypeAttribute ), false );
            if( metadataTypeAttribute != null )
            {
                int index = 0;
                foreach( var memberInfo in metadataTypeAttribute.MetadataClassType.GetMembers().Where( m => m.MemberType == MemberTypes.Field || m.MemberType == MemberTypes.Property ) )
                {
                    int pos = columns.FindIndex( c => c.Name == memberInfo.Name );
                    if( pos >= 0 )
                    {
                        MetaColumn column = columns[ pos ];
                        columns.RemoveAt( pos );
                        columns.Insert( index++, column );
                    }
                }
            }
            _columns = columns;
        }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:27,代码来源:FieldGenerator.cs


示例2: GetEntityTemplateVirtualPathWithCaching

        private string GetEntityTemplateVirtualPathWithCaching(MetaTable table, DataBoundControlMode mode, string uiHint) {
            long cacheKey = Misc.CombineHashCodes(table, mode, uiHint);

            return _factory.GetTemplatePath(cacheKey, delegate() {
                return GetEntityTemplateVirtualPath(table, mode, uiHint);
            });
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:EntityTemplateFactory.cs


示例3: Page_Init

        protected void Page_Init(object sender, EventArgs e)
        {
            this.table = DynamicDataRouteHandler.GetRequestMetaTable(this.Context);

            this.FormView1.SetMetaTable(this.table);
            this.DetailsDataSource.ContextTypeName = this.table.DataContextType.FullName;
        }
开发者ID:Jarolim,项目名称:AllMyHomeworkForTelerikAcademy,代码行数:7,代码来源:Edit.aspx.cs


示例4: AreEntitiesEqual

        private static bool AreEntitiesEqual(MetaTable table, object entity1, object entity2)
        {
            var pks1 = table.GetPrimaryKeyValues(entity1);
            var pks2 = table.GetPrimaryKeyValues(entity2);

            return pks1.SequenceEqual(pks2);
        }
开发者ID:NuGetPrototypes,项目名称:NuGetGallery,代码行数:7,代码来源:ManyToMany_Edit.ascx.cs


示例5: Page_Init

        protected void Page_Init(object sender, EventArgs e)
        {
            table = DynamicDataRouteHandler.GetRequestMetaTable(Context);
            GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context));
            GridDataSource.EntityTypeFilter = table.EntityType.Name;

            // Set the search data fields to all the string columns
            var searchExpression = (SearchExpression)GridQueryExtender.Expressions[1];
            searchExpression.DataFields = String.Join(",", table.Columns.Where(c => c.IsString).Select(c => c.Name));
            if (String.IsNullOrEmpty(searchExpression.DataFields))
            {
                // No string fields, remove the search elements
                SearchPanel.Visible = false;
                GridQueryExtender.Expressions.Remove(searchExpression);
            }

            // Disable various options if the table is readonly
            GridView1.ColumnsGenerator = new OrderedFieldGenerator(table);
            if (table.IsReadOnly)
            {
                GridView1.Columns[0].Visible = false;
                InsertHyperLink.Visible = false;
                GridView1.EnablePersistedSelection = false;
            }
        }
开发者ID:henrycomein,项目名称:NuGetGallery,代码行数:25,代码来源:List.aspx.cs


示例6: Page_Init

        protected void Page_Init(object sender, EventArgs e)
        {
            table = DynamicDataRouteHandler.GetRequestMetaTable(Context);
            GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context));
            GridDataSource.EntityTypeFilter = table.EntityType.Name;

        }
开发者ID:50minutos,项目名称:ATENTO-ASP.NET,代码行数:7,代码来源:List.aspx.cs


示例7: Page_Load

        //-------------------------------------------------------------------------------------------
        protected void Page_Load(object sender, EventArgs e)
        {
            table = DynamicDataRouteHandler.GetRequestMetaTable(Context);

               WeavverMaster.SetChatVisibility(true);
               WeavverMaster.FixedWidth = false;
               WeavverMaster.Width = "100%";
               WeavverMaster.FormTitle = table.DisplayName;
               WeavverMaster.FormDescription = GetPageContent("Logistics/Products/Showcase_Description");

               //GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context));
               //GridView1.RowCreated += new GridViewRowEventHandler(GridView1_RowCreated);
               GridDataSource.EntityTypeFilter = table.EntityType.Name;

               if (table.EntityType.FullName.Contains("Logistics_Products"))
               {
                    if (LoggedInUser == null || LoggedInUser.OrganizationId != SelectedOrganization.OrganizationId)
                    {
                         GridDataSource.WhereParameters.Add(new Parameter("IsPublic", DbType.Boolean, "True"));
                    }
               }
               GridDataSource.WhereParameters.Add(new Parameter("OrganizationId", DbType.Guid, SelectedOrganization.Id.ToString()));

               GridDataSource.OrderBy = "it.Name";

               WeavverMaster.FormTitle = table.DisplayName;
               GridDataSource.Include = table.ForeignKeyColumnsNames;

               StoreSpecials.Text = GetPageContent("Sales/Store Specials");
        }
开发者ID:weavver,项目名称:weavver,代码行数:31,代码来源:Showcase.aspx.cs


示例8: Page_Init

        //-------------------------------------------------------------------------------------------
        protected void Page_Init(object sender, EventArgs e)
        {
            table = DynamicDataRouteHandler.GetRequestMetaTable(Context);

               //GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context));
               //GridView1.RowCreated += new GridViewRowEventHandler(GridView1_RowCreated);
               GridDataSource.EntityTypeFilter = table.EntityType.Name;

               // HACKED TOGETHER FOR NOW
               if (User.Identity.IsAuthenticated)
               {
                    GridDataSource.WhereParameters.Add(new Parameter("OrganizationId", DbType.Guid, LoggedInUser.OrganizationId.ToString()));
               }
               else
               {
                    GridDataSource.WhereParameters.Add(new Parameter("OrganizationId", DbType.Guid, "0baae579-dbd8-488d-9e51-dd4dd6079e95"));
               }

               GridDataSource.OrderBy = "it.PublishAt desc";

               Master.FixedWidth = true;
               Master.FormTitle = table.DisplayName;
               IsPublic = true;

               //Master.FormTitle = "Professional Services";
               Master.FormDescription = "If you need help or would like to discuss a custom project please call us at +1-714-872-5920.";

               if (Roles.IsUserInRole("Administrators"))
                    AdminLinks.Visible = true;
        }
开发者ID:weavver,项目名称:weavver,代码行数:31,代码来源:PressRoll.aspx.cs


示例9: Page_Init

        protected void Page_Init(object sender, EventArgs e)
        {
            table = DynamicDataRouteHandler.GetRequestMetaTable(Context);
            FormView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context));

            DetailsDataSource.DomainServiceTypeName = table.DataContextType.AssemblyQualifiedName;
            DetailsDataSource.QueryName = table.GetSelectMethod();
        }
开发者ID:davidebbo-test,项目名称:DomainServiceDynamicData,代码行数:8,代码来源:Insert.aspx.cs


示例10: BuildSingleItemQuery

        public static MethodCallExpression BuildSingleItemQuery(IQueryable query, MetaTable metaTable, string[] primaryKeyValues) {
            // Items.Where(row => row.ID == 1)
            var whereCall = BuildItemsQuery(query, metaTable, metaTable.PrimaryKeyColumns, primaryKeyValues);
            // Items.Where(row => row.ID == 1).Single()
            var singleCall = Expression.Call(typeof(Queryable), "Single", new Type[] { metaTable.EntityType }, whereCall);

            return singleCall;
        }
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:8,代码来源:LinqExpressionHelper.cs


示例11: Page_Init

 protected void Page_Init(object sender, EventArgs e) {
     table = DynamicDataRouteHandler.GetRequestMetaTable(Context);
     GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context));
     GridDataSource.EntityTypeName = table.EntityType.AssemblyQualifiedName;
     if (table.EntityType != table.RootEntityType) {
         GridQueryExtender.Expressions.Add(new OfTypeExpression(table.EntityType));
     }
 }
开发者ID:roysalor,项目名称:Curso-ASP.NET,代码行数:8,代码来源:List.aspx.cs


示例12: AdvancedFieldGenerator

        /// <summary>
        /// Creates a new AdvancedFieldGenerator.
        /// </summary>
        /// <param name="table">The table this class generates fields for.</param>
        /// <param name="multiItemMode"><value>true</value> to indicate a multi-item control such as GridView, <value>false</value> for a single-item control such as DetailsView.</param>
        public AdvancedFieldGenerator(MetaTable table, bool multiItemMode) {
            if (table == null) {
                throw new ArgumentNullException("table");
            }

            _table = table;
            _containerType = multiItemMode ? ContainerType.List : ContainerType.Item;
            SkipList = new List<MetaColumn>();
        }
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:14,代码来源:AdvancedFieldGenerator.cs


示例13: Page_Init

 protected void Page_Init(object sender, EventArgs e)
 {
     table = DynamicDataRouteHandler.GetRequestMetaTable(Context);
     DetailsView1.SetMetaTable(table);
     DetailsDataSource.EntityTypeFilter = table.EntityType.Name;
     DetailsView1.RowsGenerator = new OrderedFieldGenerator(table);
     Title = table.DisplayName;
     DetailsDataSource.Include = table.ForeignKeyColumnsNames;
 }
开发者ID:henrycomein,项目名称:NuGetGallery,代码行数:9,代码来源:Edit.aspx.cs


示例14: Page_Init

        protected void Page_Init(object sender, EventArgs e)
        {
            table = DynamicDataRouteHandler.GetRequestMetaTable(Context);
            FormView1.SetMetaTable(table);

            DetailsDataSource.DomainServiceTypeName = table.DataContextType.AssemblyQualifiedName;
            DetailsDataSource.QueryName = table.GetSelectMethod();
            FormView1.DataKeyNames = table.PrimaryKeyColumns.Select(c => c.Name).ToArray();
        }
开发者ID:davidebbo-test,项目名称:DomainServiceDynamicData,代码行数:9,代码来源:Details.aspx.cs


示例15: Page_Init

        protected void Page_Init(object sender, EventArgs e)
        {
            table = DynamicDataRouteHandler.GetRequestMetaTable(Context);
            FormView1.SetMetaTable(table);
            DetailsDataSource.EntityTypeFilter = table.EntityType.Name;

            DetailsDataSource.ContextCreating += (o, args) =>
            {
                args.Context = (ObjectContext)table.CreateContext();
            };
        }
开发者ID:ZhiYuanHuang,项目名称:NuGetGallery,代码行数:11,代码来源:Edit.aspx.cs


示例16: Page_Init

        protected void Page_Init(object sender, EventArgs e)
        {
            table = DynamicDataRouteHandler.GetRequestMetaTable(Context);
            GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context));

            GridDataSource.DomainServiceTypeName = table.DataContextType.AssemblyQualifiedName;
            GridDataSource.QueryName = table.GetSelectMethod();

            GridView1.ColumnsGenerator = new DefaultAutoFieldGenerator(table);
            GridView1.DataKeyNames = table.PrimaryKeyColumns.Select(c => c.Name).ToArray();
        }
开发者ID:davidebbo-test,项目名称:DomainServiceDynamicData,代码行数:11,代码来源:List.aspx.cs


示例17: SortColumns

 private static IEnumerable<MetaColumn> SortColumns(MetaTable table, IEnumerable<MetaColumn> columns)
 {
     string[] order;
     if (!SortOrders.TryGetValue(table.Name, out order))
     {
         order = new string[0];
     }
     return Enumerable.Concat(
         order.Select(s => columns.Single(c => String.Equals(c.Name, s))),
         columns.Where(c => !order.Contains(c.Name)));
 }
开发者ID:igor-rif-shevchenko,项目名称:NuGetGallery,代码行数:11,代码来源:OrderedFieldGenerator.cs


示例18: CreateEntityTemplate

        public virtual EntityTemplateUserControl CreateEntityTemplate(MetaTable table, DataBoundControlMode mode, string uiHint) {
            if (table == null) {
                throw new ArgumentNullException("table");
            }

            string entityTemplatePath = GetEntityTemplateVirtualPathWithCaching(table, mode, uiHint);
            if (entityTemplatePath == null) {
                return null;
            }

            return _templateInstantiator(entityTemplatePath);
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:12,代码来源:EntityTemplateFactory.cs


示例19: BuildItemsQuery

 public static MethodCallExpression BuildItemsQuery(IQueryable query, MetaTable metaTable, IList<MetaColumn> columns, string[] values) {
     // row
     var rowParam = Expression.Parameter(metaTable.EntityType, "row");
     // row.ID == 1
     var whereBody = BuildWhereBody(rowParam, columns, values);
     // row => row.ID == 1
     var whereLambda = Expression.Lambda(whereBody, rowParam);
     // Items.Where(row => row.ID == 1)
     var whereCall = Expression.Call(typeof(Queryable), "Where", new Type[] { metaTable.EntityType }, query.Expression, whereLambda);
     
     return whereCall;
 }
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:12,代码来源:LinqExpressionHelper.cs


示例20: Page_Init

        protected void Page_Init(object sender, EventArgs e)
        {
            IsPublic = true;

               table = DynamicDataRouteHandler.GetRequestMetaTable(Context);
               FormView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context));
               DetailsDataSource.EntityTypeFilter = table.EntityType.Name;

               Master.FormTitle = "Add new entry to " + table.DisplayName;

               DetailsDataSource.Inserted += new EventHandler<EntityDataSourceChangedEventArgs>(DetailsDataSource_Inserted);
        }
开发者ID:weavver,项目名称:weavver,代码行数:12,代码来源:Insert.aspx.cs



注:本文中的System.Web.DynamicData.MetaTable类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Helpers.WebImage类代码示例发布时间:2022-05-26
下一篇:
C# DynamicData.MetaColumn类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap