0
votes

Zipped up my application for a university assignment and now suddenly it wont work???I Used visual studio to create a class diagram and added assosciations, could this have altered the code?

Below is the error i get when i try launch in browser..

Server Error in '/' Application. Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'WebApplication4.MvcApplication'.

Source Error:

Line 1: <%@ Application Codebehind="Global.asax.cs" Inherits="WebApplication4.MvcApplication" Language="C#" %>

Source File: /global.asax Line: 1

i get this error when i try build my project

Error 2 The type 'WebApplication4.Models.CoreSheetsDBContext' cannot be used as type parameter 'TContext' in the generic type or method 'System.Data.Entity.Migrations.DbMigrationsConfiguration'. There is no implicit reference conversion from 'WebApplication4.Models.CoreSheetsDBContext' to 'System.Data.Entity.DbContext'. G:\Software\Projects\WebApplication4\WebApplication4\Migrations\Configuration.cs 8 27 WebApplication4

1

1 Answers

0
votes

// First guess was: Try changing CodeBehind to CodeFile.

Update (question was updated)

(1) A "/" at the end of line 8 is not syntactically correct. (Does it look the same in your code? Would be fine know to the rest of the line including the closing '>',)

... sealed class Configuration : DbMigrationsConfiguration
     <WebApplication4.Models.CoreSheetsDBContext/

(2) Let's assume that the ´/´ was just a typo and your code contains a ´>´ instead. DbMigrationsConfiguration has this signature:

public class DbMigrationsConfiguration<TContext> 
   : DbMigrationsConfiguration where TContext : System.Data.Entity.DbContext

The class CoreSheetsDBContext which you pass as a generic parameter must be a subclass of System.Data.Entity.DbContext. Check that CoreSheetsDBContext actually inherits from System.Data.Entity.DbContext. I.e. it should look like this:

using System.Data.Entity;

public class CoreSheetsDBContext : DbContext { ... }