Reputation: 3944
I'm working on an ASP.Net application. For one part of this, I have particular models stored in their own folder:
I have a reference to my Models/Default/
folder in one of my CustomControls: using Project.Models.Default
; However, when I try to make a reference in my CustomControl YearsOfService
to my default Model of Years_Of_Service
, Visual Studio (2013) is not picking up either my Years_Of_Service
or Years_Of_Service_Data
model with my Models/Default/
folder:
Anyone have any ideas why this is happening?
EDIT:
Years_Of_Service.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace PROJECT.Models
{
public class YearsOfService
{
public string Year { get; set; }
public decimal ServiceCredited { get; set; }
public decimal Salary { get; set; }
public string CoveredEmployer { get; set; }
}
}
Years_Of_Service_Data.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace PROJECT.Models
{
public class YearsOfServiceData
{
public List<YearsOfService> YearsOfService { get; set; }
}
}
Upvotes: 1
Views: 747
Reputation: 8147
You currently have:
namespace PROJECT.Models
But this should also contain Default
like this:
namespace PROJECT.Models.Default
So, it should end up like this:
namespace PROJECT.Models.Default
{
public class YearsOfServiceData
{
public List<YearsOfService> YearsOfService { get; set; }
}
}
Finally, you may want to keep your file names and class names the same otherwise it can get very confusing! So, stick with either Years_Of_Service_Data or YearsOfServiceData in both file and class name.
Upvotes: 1
Reputation: 119017
The classes contained in those files are just in the wrong namespace. Specify the correct one like this:
namespace XXXX.Models.Default
{
public class YearsOfService
{
//Snip
}
}
Alternatively, refer to them with their namespace as XXXX.Models.YearsOfService
Upvotes: 1