here's are the modifications that got it working for me.

in the onmodelcreating() method, add this line:

    protected override void onmodelcreating(dbmodelbuilder modelbuilder)
        // ...
        modelbuilder.conventions.add(new functionsconvention("dbo", this.gettype()));

when defining the dbfunction stub use these attributes:

    [dbfunction("codefirstdatabaseschema", "echo")]
    public static string echo(string text)
        throw new notsupportedexception("direct calls are not supported.");

i took ideas from this link

here's the test i performed to see if it was the issue you were having: if i comment out the modelbuilder.conventions.add line above, i receive a similar error to what you were receiving.

system.notsupportedexception: 'the specified method 'system.string echo(system.string)' on the type 'try1.excontext' cannot be translated into a linq to entities store expression.'

Related Query

More Query from same tag