Trouble connecting F# to an Entity Framework model RRS feed

  • Question

  • Hello,

    I've been trying out this MSDN walkthrough to connect F# to an edmx file. I started an empty solution, and added a C# class library, to which I added an Entity Framework model. I then added an F# console app to the solution. My solution now looked like this...

    Following what was in that MSDN article, I added the following line to my F# code file...

    type edmx = EdmxFile<"DonationsManagerModel.edmx", ResolutionFolder = @"..\EfModel">

    However, the type name is underlined in red, and I get the error message...

    The provided types generated by this use of a type provider may not be used from other F# assemblies and should be marked internal or private. Consider using 'type internal TypeName = ...' or 'type private TypeName = ...'.

    I've been searching, but haven't managed to find anything that I understand that would help solve this. Anyone any ideas?


    FREE custom controls for Lightswitch! A collection of useful controls for Lightswitch developers (Silverlight client only). Download from the Visual Studio Gallery.

    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/

    Wednesday, December 30, 2015 8:10 PM

All replies

  • Hello,

    I tried to reference the edmx project in f# one but nothing changes, the only way to have the compiler to pass the issue is to declare the edmx as private type, and referencing the System.Data.Entity, maybe it is related to the design of the type provider itself.

    type private edmx = EdmxFile<"Model1.edmx", ResolutionFolder = @"..\EdmxFSharp_CSharp">

    Good Coding;

    Friday, September 14, 2018 10:24 AM