Click here to Skip to main content
15,670,416 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Newbie following Contoso tutorial ready to start my own. Simple db 6 tables such as builder, supervisor, lot, subdivision, all leading to a house containing just indicies to other tables. After numerous retries, all tables except the house are properly seeded. So I thought I’d reduce the 6 types down to 3 to try to isolate the seed problem. I have been manually deleting the migration file created by the InitialCreate and the (local) db [BSV.MDF], make changes to the seed file and then rerun the “ add-migration InitialCreate” then an “update database” (about 10 times). When I commented out some fields I received this error “The EntityFramework package is not installed on test project “BSV.Test”.

This is my class: [with the commented types]
public class House
      public int HouseID { get; set; }
      public int BuilderID { get; set; }
      public int HstyleID { get; set; }
      public int FstyleID { get; set; }
      //public int LotID { get; set; }
      //public int SubdivID { get; set; }
      //public int StepID { get; set; }
      //public int SuperID { get; set; }

      public virtual Builder Builder { get; set; }
      public virtual Hstyle Hstyle { get; set; }
      public virtual Fstyle Fstyle { get; set; }
      //public virtual Lot Lot { get; set; }
      //public virtual Subdiv Subdiv { get; set; }
      //public virtual Supervisor Supervisor { get; set; }

      //public virtual ICollection<Step> steps { get; set; }

and in the seed method

new House {
    HstyleID = Hstyles.Single(s => s.HName =="Wingate").HstyleID,
    BuilderID = Builders.Single(d => d.BName =="Demo").BuilderID,
    FstyleID = Fstyles.Single(a => a.FName =="Brick").FstyleID,
    //SubdivID = Subdivs.Single(b => b.SubName == "Glen Meadows").SubdivID,
    //LotID = Lots.Single(c => c.LotName == "101").LotID,
    //SuperID = Supervisors.Single(d => d.SuperName =="Ralph").SuperID,
    //StepID = Steps.Single(e => e.StepDesc == "Clear lot").StepID,

So as I said I was able to delete, and recreate this db many times until I commented out these lines after which I receive the error about the BSV.Test.

After many hrs I give up. This is the first reference to the BSV.test db. Why now??

BTW I then uncommented the lines and do an InitialCreate, I receive the following error "Could not load assembly 'BSV.Tests'. (If you are using Code First Migrations inside Visual Studio this can happen if the startUp project for your solution does not reference the project that contains your migrations. You can either change the startUp project for your solution or use the -StartUpProjectName parameter.)" Dumb ? Are they looking for my context name? Where is the startup project found [and named]?

Obviously, I’m just learning methods, properties, and the MVC structure. Big mystery as to how it all interacts to function and particularly where thing are and go. I’m an old timer who’s done micro embedded programming for 30+ years, but this MVC stuff is like an ocean liner compared to my rowboat. Please be very explicit with answer.

If I look in bin folder there are many subfolders with identical files, May I delete these? Manually?

How do I fix this? Can I manually "remove" xxx files to get back to a clean start? Sounds dangerous, but I don't want to restart by creating a new project and reentering all the MVC's

Many thanks John - newbie

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900