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.
It looks like it's not possible to declare a function in a base
DbContextbecause thenamespaceNamepassed 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
namespaceNameof the baseDbContextit 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.