2011-12-23 19 views
4

我试图转换下面的C#代码到VB.NET,得到了在编译的代码“表达式不会产生一个值”错误错误:表达式不会产生一个值

C#代码

 return Fluently.Configure().Mappings(m => m.FluentMappings.AddFromAssemblyOf<MyEntityMapping>()) 
      .Database(SQLiteConfiguration.Standard.InMemory().ShowSql()) 
      .ExposeConfiguration(x => new SchemaExport(x).Execute(false, true, false)) 
      .BuildSessionFactory(); 

VB.NET代码

Return Fluently.Configure() _ 
     .Mappings(Function(m) m.FluentMappings.AddFromAssemblyOf(Of SubscriptionMap)()) _ 
     .Database(SQLiteConfiguration.Standard.InMemory().ShowSql()) _ 
     .ExposeConfiguration(Function(x) New SchemaExport(x).Execute(False, True, False)) _ 
     .BuildSessionFactory() 

错误发生在VB.NET代码的第二行,而C#代码编译没有问题。

转换出了什么问题?

感谢


回答

5

你需要创建一个Sub(x),而不是一个Function(x)

+0

如果我更改为Sub(x)New SchemaExport(x).Execute(False,True,False)'现在我得到了New的语法错误。 – hardywang 2011-12-23 15:26:51

+0

你需要升级到VB.Net 2010 – SLaks 2011-12-23 15:27:37

+0

它是在VB.NET 2010. – hardywang 2011-12-23 15:29:03

相关问题