none
How to resolve error: "An Explicit Conversion exists (Are you missing a Cast?)" ? RRS feed

  • Question

  • The Screenshot above displays the error which I am unable to resolve. Please help me solve this issue.

    Thursday, September 17, 2015 10:04 AM

Answers

  • "The type 'System.Data.Entity.DbContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' D:\Systle\Court Case Information System\CCIS\App.xaml.cs".

    This error message indicates that your project doesn't reference Entity Framework assembly, reference entity and see whether the problem gone.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, September 21, 2015 5:57 AM
    Moderator

All replies

  • What does CCISEntities derive from?

    Why are you trying to use it as an IContext?

    Without knowing the answer to these questions, you could do an experiment:  You could hit it with a hammer and see what happens:

    this.context = (IContext)new CCISEntities();

    You might get an exception that your CCISEntities is not an IContext.  In which case we'll have get an answer to those questions I asked and figure out what is set up incorrectly.

    Thursday, September 17, 2015 11:11 AM
  • Hello Wyck,

    Thanks for replying.

    CCISEntities is the Entity Container Name of my CCISModel.edmx and the reason why I am trying to use it as an IContext is that I am following the sample "Employee Tracker" available in Visual Studio Sample Gallery to learn developing WPF Application and it has been shown that way in the sample application in the App.xml.cs file. But when I try it, I get the error.

    As suggested, I also hammered it with this.context = (IContect)new CCISEntities(); only to see red line removed and getting blue line under "this" of this.context = (IContext) new CCISEntities(); with the following message:

    "The type 'System.Data.Entity.DbContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' D:\Systle\Court Case Information System\CCIS\App.xaml.cs".

    I hope you could find the possible cause of the error and help me.

    Warm Regards.

    Friday, September 18, 2015 6:23 AM
  • You must add a reference to assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

    So?  Did you do that?  Does it work now?

    How did you reference the entity framework?  Did you add it with Nuget?

    Friday, September 18, 2015 12:10 PM
  • Sir,

    Please tell me what should I do instead of confusing me with a number of questions. I don't know how to reference the entity framework. I am using entity framework 5 and add it to the project using Add New Item. Please let me know how to get rid of this error.

    Friday, September 18, 2015 3:56 PM
  • "The type 'System.Data.Entity.DbContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' D:\Systle\Court Case Information System\CCIS\App.xaml.cs".

    This error message indicates that your project doesn't reference Entity Framework assembly, reference entity and see whether the problem gone.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, September 21, 2015 5:57 AM
    Moderator