本文整理汇总了C#中System.Web.DynamicData.MetaTable类的典型用法代码示例。如果您正苦于以下问题:C# MetaTable类的具体用法?C# MetaTable怎么用?C# MetaTable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MetaTable类属于System.Web.DynamicData命名空间,在下文中一共展示了MetaTable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
});
}
示例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;
}
示例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);
}
示例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;
}
}
示例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;
}
示例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");
}
示例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;
}
示例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();
}
示例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;
}
示例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));
}
}
示例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>();
}
示例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;
}
示例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();
}
示例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();
};
}