Skip to content

DbFunction namespace in base DbContext #13

@michaelcsikos

Description

@michaelcsikos

It looks like it's not possible to declare a function in a base DbContext because the namespaceName passed to [DbFunction("DbContextClassName", "FunctionName"] needs to be the name of the subclass.

If the name of the subclass is identical but in a different C# namespace, it works, but that's not always practical. If the names are different, and we pass in the namespaceName of the base DbContext it throws the following exception when using the function:

The specified method 'System.Linq.IQueryable`1[System.String] FunctionName(System.String)' on the type 'Example.BaseDbContextName' cannot be translated into a LINQ to Entities store expression.

Is this something that could be fixed, or is there another way? Thanks for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions