2009-08-08 20 views
0
 model.RegisterContext(typeof(NorthwindDataContext), new ContextConfiguration() 
    { 
     ScaffoldAllTables = true, 
     MetadataProviderFactory = (type => new DefaultTypeDescriptionProvider(type, new AssociatedMetadataTypeTypeDescriptionProvider(type))) 
    }); 

特别是MetadataProviderFactory线......我不能完全似乎弄清楚它应该如何看在VB ...将C#动态数据上下文注册码转换为VB?

回答

1
MetadataProviderFactory = Function(type) new DefaultTypeDescriptionProvider(
    type, new AssociatedMetadataTypeTypeDescriptionProvider(type)) 
1
MetadataProviderFactory = Function (type) New DefaultTypeDescriptionProvider(
    type, New AssociatedMetadataTypeTypeDescriptionProvider(type)) 
1

我相信你正在寻找的东西像这样:

model.RegisterContext(GetType(NorthwindDataContext), 
    New ContextConfiguration() With 
    { 
     .ScaffoldAllTables = True, 
     .MetadataProviderFactory = Function(type) _ 
      New DefaultTypeDescriptionProvider(
       type, 
       New AssociatedMetadataTypeTypeDescriptionProvider(type)) 
    })