hardywang
hardywang

Reputation: 5192

Error: Expression does not produce a value

I tried to convert following C# code into VB.NET and got "Expression does not produce a value" error while compiling the code

C# Code

        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 Code

    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()

The error happens on 2nd last line of VB.NET code, while C# code is compiled without problem.

What is wrong with the converting?

Thanks


Upvotes: 4

Views: 2327

Answers (1)

SLaks
SLaks

Reputation: 888185

You need to create a Sub(x), not a Function(x).

Upvotes: 5

Related Questions