Erro while binding data to grid by collection list - entity-framework-4

I am trying to bind list collection to data-grid but its giving an error.
The type 'System.Data.Objects.ObjectContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
Data Layer Code :
public class Employees
{
public List<Employee> LoadEmployees()
{
try
{
EMployeeDB1Entities EE = new EMployeeDB1Entities();
var Employees = EE.Employees.Where(p => p.Name.StartsWith("T"));
return Employees.ToList();
// var myCollection = new ObservableCollection<Employee>(this.LoadEmployees());
}
catch
{
return null;
}
}
UI Layer Code
private void button1_Click(object sender, EventArgs e)
{
Employees E1 = new Employees();
// error gives in below line.
dataGridView1.DataSource = E1.LoadEmployees();
}
Whats the solution ?
Thanks in advance...

The error clearly states that you are missing the reference of System.Data.Entity class in your project, you need to add it by the same simple process. Right click on add reference , then .Net tab and select System.Data.Entity from the list.
and you will be good to go.

Related

Why is .NET MAUI Dependency Injection crashing my app?

I'm trying to follow this article on .NET MAUI dependency injection.
My MauiProgram.cs
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.UseMauiCommunityToolkit()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});
builder.Services.AddSingleton<IDataService, DataService>();
builder.Services.AddTransient<NavigationService>();
builder.Services.AddTransient<ValidationService>();
builder.Services.AddSingleton<BudgetViewPage>();
builder.Services.AddSingleton<BudgetViewModel>();
builder.Services.AddSingleton<AccountsViewModel>();
builder.Services.AddSingleton<FlyoutMenuRoot>();
return builder.Build();
}
}
My App.xaml.cs
public partial class App : Application
{
public App(FlyoutMenuRoot flyoutMenuRoot)
{
InitializeComponent();
MainPage = flyoutMenuRoot;
}
}
My FlyoutMenuRoot.xaml.cs
public partial class FlyoutMenuRoot : FlyoutPage
{
IDataService dataService;
BudgetViewModel budgetViewModel;
private NavigationService NavigationService = new();
public FlyoutMenuRoot(IDataService dataService, BudgetViewModel budgetViewModel)
{
InitializeComponent();
this.dataService = dataService;
this.budgetViewModel = budgetViewModel;
Detail = new NavigationPage(new BudgetViewPage(budgetViewModel));
flyoutMenuRoot.flyoutCollectionView.SelectionChanged += OnSelectionChanged;
}
void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
var item = e.CurrentSelection.FirstOrDefault() as FlyoutPageItem;
if(item != null)
{
if(item.TargetType == typeof(SelectAccountPage))
{
NavigationService.PushToStack((Page)Activator.CreateInstance(item.TargetType, new AccountsViewModel(dataService, budgetViewModel)));
}
else
{
NavigationService.PushToStack((Page)Activator.CreateInstance(item.TargetType));
}
this.IsPresented = false;
flyoutMenuRoot.flyoutCollectionView.SelectedItem = null;
}
}
}
Based on the linked article, this should work, but my app crashes on the splash screen.
If my App.xaml.cs is this:
public partial class App : Application
{
public App()
{
InitializeComponent();
DataService dataService = new();
BudgetViewModel budgetViewModel = new(dataService);
MainPage = new FlyoutMenuRoot(dataService, budgetViewModel);
}
}
Then it works with no problem.
My understanding is that you shouldn't have to new() up an instance of your classes with Dependency Injection, that the container will do it automatically for you based on what's listed in the constructor. I'm following the article, so why is it crashing?
Edit:
I stepped through the code and narrowed the crash down to the InitializeComponent() call under FlyoutMenuPage()
public partial class FlyoutMenuPage : ContentPage
{
public FlyoutMenuPage()
{
try
{
InitializeComponent();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
The message written to the output window is:
[DOTNET] Position 11:5. StaticResource not found for key Primary
That's referencing this line in the FlyoutMenuPage.xaml
BackgroundColor="{StaticResource Primary}"
This is confounding because that line never threw an exception until I tried following the method for DI from the article. If I go back to constructor injection, it doesn't crash.
First.
DI is there for you, so you don't have to construct your classes manually. (As I told you yesterday) You add classes as Singletons, and at the same time, you are manually constructing them. DI will call those constructions when needed. Your idea that they are "never initialized" and you have to do it at least once is wrong.
Second.
DI is not "crashing" your app. If anything, not injecting services and/or ViewModels cause runtime exceptions. (When you try to navigate to something, that uses such Type in its constructor for example.) Not the oposite.
Third.
DI has very little to do with XAML/Resources problems. Especially with your BackgroundColor problem.
So I'm experiencing a logical issue. Take this App for example:
public partial class App : Application
{
public App(MainPage mp, MainPageViewModel vm)
{
InitializeComponent();
MainPage = mp; // new MainPage(); //AppShell();
MainPage.BindingContext= vm;
}
}
And in the App.xaml, we have this:
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MVVMDI"
x:Class="MVVMDI.App">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
Because I have MainPage in my constructor, ready for dependency injection, the xaml in MainPage gets loaded up before the xaml in App. So, with that in mind, App.xaml hasn't yet registered the Colors.xaml because InitializeComponent hasn't been called yet. So because MainPage is trying to reference StaticResource Primary, which is in Colors.xaml, which hasn't been registered yet, I get my exception.
This answers my question as to why DI is making my app crash.
(So to solve this, I just need to find a way to register Colors.xaml application-wide like App does....)

UWP Template 10 and Service Dendency Injection (MVVM) not WPF

I have spent over two weeks searching google, bing, stack overflow, and msdn docs trying to figure out how to do a proper dependency injection for a mobile app that I am developing. To be clear, I do DI every day in web apps. I do not need a crash course on what, who, and why DI is important. I know it is, and am always embracing it.
What I need to understand is how this works in a mobile app world, and in particular a UWP Template 10 Mobile app.
From my past, in a .net/Asp app I can "RegisterType(new XYZ).Singleton() blah" {please forgive syntax; just an example} in App_Start.ConfigureServices. This works almost identical in .netcore, granted some syntactic changes.
My problem is now I am trying to provide my api is going to an UWP app that needs to digest my IXYZ service. By no means do I think that they should "new" up an instance every time. There has to be a way to inject this into a container on the UWP side; and I feel I am missing something very simple in the process.
Here is the code I have:
App.xaml.cs
public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
// TODO: add your long-running task here
//if (args.Kind == ActivationKind.LockScreen)
//{
//}
RegisterServices();
await NavigationService.NavigateAsync(typeof(Views.SearchCompanyPage));
}
public static IServiceProvider Container { get; private set; }
private static void RegisterServices()
{
var services = new ServiceCollection();
services.AddSingleton<IXYZ, XYZ>();
Container = services.BuildServiceProvider();
}
MainPage.xaml.cs:
public MainPage()
{
InitializeComponent();
NavigationCacheMode = NavigationCacheMode.Enabled;
}
MainPageViewModel:
public class MainPageViewModel : ViewModelBase
{
private readonly IXYZ _xyz;
public MainPageViewModel(IXYZ xyz)
{
//Stuff
_xyz= xyz;
}
}
I now get the error:
XAML MainPage...ViewModel type cannot be constructed. In order to be constructed in XAML, a type cannot be abstract, interface nested generic or a struct, and must have a public default constructor.
I am willing to use any brand of IoC Container, but what I need is an example of how to properly use DI for services in a UWP app. 99.9% of questions about DI is about Views (i.e. Prism?) not just a simple DI for a service (i.e. DataRepo; aka API/DataService).
Again, I feel I am missing something obvious and need a nudge in the right direction. Can somebody show me an example project, basic code, or a base flogging on how I should not be a programmer...please don't do that (I don't know if my ego could take it).
You can try to Microsoft.Hosting.Extensions just like ASP.NET, there's an implementation on Xamarin.Forms by James Montemagno, as well it can be used in UWP I have tried and it works perfectly. You have to change some parts in order to get it working.
In OnLaunched Method add Startup.Init();
public static class Startup
{
public static IServiceProvider ServiceProvider { get; set; }
public static void Init()
{
StorageFolder LocalFolder = ApplicationData.Current.LocalFolder;
var configFile = ExtractResource("Sales.Client.appsettings.json", LocalFolder.Path);
var host = new HostBuilder()
.ConfigureHostConfiguration(c =>
{
// Tell the host configuration where to file the file (this is required for Xamarin apps)
c.AddCommandLine(new string[] { $"ContentRoot={LocalFolder.Path}" });
//read in the configuration file!
c.AddJsonFile(configFile);
})
.ConfigureServices((c, x) =>
{
// Configure our local services and access the host configuration
ConfigureServices(c, x);
}).
ConfigureLogging(l => l.AddConsole(o =>
{
//setup a console logger and disable colors since they don't have any colors in VS
o.DisableColors = true;
}))
.Build();
//Save our service provider so we can use it later.
ServiceProvider = host.Services;
}
static void ConfigureServices(HostBuilderContext ctx, IServiceCollection services)
{
//ViewModels
services.AddTransient<HomeViewModel>();
services.AddTransient<MainPageViewModel>();
}
static string ExtractResource(string filename, string location)
{
var a = Assembly.GetExecutingAssembly();
using (var resFilestream = a.GetManifestResourceStream(filename))
{
if (resFilestream != null)
{
var full = Path.Combine(location, filename);
using (var stream = File.Create(full))
{
resFilestream.CopyTo(stream);
}
}
}
return Path.Combine(location, filename);
}
}
Injecting a ViewModel is possible as well which is pretty nice.
With help from #mvermef and the SO question Dependency Injection using Template 10 I found a solutions. This turned out to be a rabbit hole where at every turn I ran into an issue.
The first problem was just getting Dependency Injection to work. Once I was able to get that figured out from the sources above I was able to start injecting my services into ViewModels and setting them to the DataContext in the code behind.
Then I ran into an injection issue problem with injecting my IXYZ services into the ViewModels of UserControls.
Pages and their ViewModels worked great but I had issues with the DataContext of the UserControl not being injected with UserControl's ViewModel. They were instead getting injected by the Page's ViewModel that held it.
The final solution turned out to be making sure that the UserControl had the DataContext being set in XAML not the code behind, as we did with the Pages, and then creating a DependencyProperty in the code behind.
To show the basic solution read below.
To make it work I started with:
APP.XAML.CS
public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
// long-running startup tasks go here
RegisterServices();
await Task.CompletedTask;
}
private static void RegisterServices()
{
var services = new ServiceCollection();
services.AddSingleton<IRepository, Repository>();
services.AddSingleton<IBinderService, BinderServices>();
**//ViewModels**
**////User Controls**
services.AddSingleton<AddressesControlViewModel, AddressesControlViewModel>();
services.AddSingleton<CompanyControlViewModel, CompanyControlViewModel>();
**//ViewModels**
**////Pages**
services.AddSingleton<CallListPageViewModel, CallListPageViewModel>();
services.AddSingleton<CallListResultPageViewModel, CallListResultPageViewModel>();
etc....
Container = services.BuildServiceProvider();
}
public override INavigable ResolveForPage(Page page, NavigationService navigationService)
{
**//INJECT THE VIEWMODEL FOR EACH PAGE**
**//ONLY THE PAGE NOT USERCONTROL**
if (page is CallListPage)
{
return Container.GetService<CallListPageViewModel>();
}
if (page is CallListResultPage)
{
return Container.GetService<CallListResultPageViewModel>();
}
etc...
return base.ResolveForPage(page, navigationService);
}
In the code behind for the Page
CALLLISTPAGE.XAML.CS
public CallListPage()
{
InitializeComponent();
}
CallListPageViewModel _viewModel;
public CallListPageViewModel ViewModel
{
get { return _viewModel ?? (_viewModel = (CallListPageViewModel)DataContext); }
}
In your XAML add your UserControl
CALLLISTPAGE.XAML
<binder:CompanyControl Company="{x:Bind ViewModel.SelectedCompany, Mode=TwoWay}"/>
In your UserControl make sure to add the DataContext to the XAML NOT the code behind like we did with the pages.
COMPANYCONTROL.XAML
<UserControl.DataContext>
<viewModels:CompanyControlViewModel x:Name="ViewModel" />
</UserControl.DataContext>
In the UserControl Code Behind add a Dependency Property
COMPANYCONTROL.XAML.CS
public static readonly DependencyProperty CompanyProperty = DependencyProperty.Register(
"Company", typeof(Company), typeof(CompanyControl), new PropertyMetadata(default(Company), SetCompany));
public CompanyControl()
{
InitializeComponent();
}
public Company Company
{
get => (Company) GetValue(CompanyProperty);
set => SetValue(CompanyProperty, value);
}
private static void SetCompany(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var control = d as CompanyControl;
var viewModel = control?.ViewModel;
if (viewModel != null)
viewModel.Company = (Company) e.NewValue;
}
In the end I am not sure if this is an elegant solution but it works.

Orchard CMS ContentManager.New<>() Specified Cast Was Invalid

I am in the early stages of developing a new module.
Much of it is laid out in terms of the models etc. Also have the migrations all set up and my database now has the tables for my module.
I am encountering the following error when calling ContentManager.New<myPart> and would like some help please.
Error is this:
An unhandled exception has occurred and the request was terminated. Please refresh the page. If the error persists, go back
Specified cast is not valid.
System.InvalidCastException: Specified cast is not valid.
at Orchard.ContentManagement.ContentCreateExtensions.New[T]
(IContentManager manager, String contentType)
The chunk of code that fires the exception is this:
public static T New<T>(this IContentManager manager, string contentType) where T : class, IContent {
var contentItem = manager.New(contentType);
if (contentItem == null)
return null;
var part = contentItem.Get<T>();
if (part == null)
throw new InvalidCastException();
return part;
}
Here are the various parts to my module that are related to the operation i am struggling with:
ContentPart
public class GoogleMapsSettingsPart : ContentPart<GoogleMapsSettingsPartRecord>
{
public string ApiKey {
get { return Record.ApiKey; }
set { Record.ApiKey = value; }
}
}
ContentPartRecord
public class GoogleMapsSettingsPartRecord : ContentPartRecord
{
public virtual string ApiKey { get; set; }
}
Handler
public GoogleMapsSettingsPartHandler(IRepository<GoogleMapsSettingsPartRecord> repository)
{
Filters.Add(StorageFilter.For(repository));
}
Migration for this table
// Settings Table
SchemaBuilder.CreateTable("GoogleMapsSettingsPartRecord", table => table
.ContentPartRecord()
.Column("ApiKey", DbType.String, c => c.WithLength(60))
);
Some of the code from the controller for this model etc
public AdminController(IContentManager contentManager, IShapeFactory shapeFactory, IServiceLocatorService serviceLocatorService, INotifier notifier)
{
_contentManager = contentManager;
_serviceLocatorService = serviceLocatorService;
_notifier = notifier;
Shape = shapeFactory;
T = NullLocalizer.Instance;
}
/// <summary>
/// Display Settings
/// </summary>
/// <returns></returns>
public ActionResult Settings()
{
var settings = _serviceLocatorService.GoogleMapsSettings;
var editor = CreateSettingsEditor(settings);
var model = _services.ContentManager.BuildEditor(settings);
return View((object)model);
}
Finally - the Services where my call throws this exception
private GoogleMapsSettingsPart _settings;
public GoogleMapsSettingsPart GoogleMapsSettings
{
get {
if (_settings == null)
{
_settings = _contentManager.Query<GoogleMapsSettingsPart, GoogleMapsSettingsPartRecord>().List().FirstOrDefault();
if (_settings == null)
{
_settings = _contentManager.New<GoogleMapsSettingsPart>("GoogleMapsSettings");
}
}
return _settings;
}
}
The actual line where the exception happens is _settings = _contentManager.New<GoogleMapsSettingsPart>("GoogleMapsSettings");
I have tried all sorts of stuff in place of "GoogleMapsSettings" though nothing is working.
I'm pretty sure at this point it's something simple, though it's avoiding me..My limited knowledge of Orchard is stumping me
Any help would be appreciated :)
The exception is thrown because your content type does not have the part you specified to get.
_contentManager.New<GoogleMapsSettingsPart>("GoogleMapsSettings");
This method call creates a new content item of type GoogleMapSettings and gets the content item as a GoogleMapsSettingsPart. However, it seems that GoogleMapSettings content type does not have a GoogleMapsSettingsPart. That's why the exception gets thrown here.
var part = contentItem.Get<T>();
if (part == null)
throw new InvalidCastException();
You must either attach the part dynamically to your content type or do it in a migration (or manually in the admin, but that's not a good idea). Your migration should look like this.
this.ContentDefinitionManager.AlterTypeDefinition("GoogleMapsSettings",
alt => alt
.WithPart("GoogleMapsSettingsPart");
Ok, so I fixed it...
My understanding of how Orchard works is still very much in the learning stages.
for this particular operation I didn't want to have a content type in the admin - though not sure why after adding the ContentType it still didn't work...
anyway, adding the lines below to my handler took care of the rest. I believe it's actually creating a temporary type so one isn't needed in the system.
public GoogleMapsSettingsPartHandler(IRepository<GoogleMapsSettingsPartRecord> repository)
{
Filters.Add(new ActivatingFilter<GoogleMapsSettingsPart>("GoogleMapsSettings"));
Filters.Add(StorageFilter.For(repository));
Filters.Add(new TemplateFilterForRecord<GoogleMapsSettingsPartRecord>("GoogleMapsSettings", "Parts/GoogleMapsSettings"));
}
I'v got the same error, but in my case it was everything ok with migration class.
The reason was unlucky merge, which deleted my driver class of my part.
Just look at this code of Activating method of ContentPartDriverCoordinator class. In my case there was no partInfo for my content part and resulted part became ContentPart, so casting throws an exception
var partInfos = _drivers.SelectMany(cpp => cpp.GetPartInfo()).ToList();
foreach (var typePartDefinition in contentTypeDefinition.Parts) {
var partName = typePartDefinition.PartDefinition.Name;
var partInfo = partInfos.FirstOrDefault(pi => pi.PartName == partName);
var part = partInfo != null
? partInfo.Factory(typePartDefinition)
: new ContentPart { TypePartDefinition = typePartDefinition };
context.Builder.Weld(part);
}

consuming select list from different class mvc

I am trying to make my code more readable.
This is an MVC project i am using an hard-coded
ViewBag.Origin = new List<SelectListItem>
{
new SelectListItem { Text = "Born", Value = "Born"},
new SelectListItem { Text = "Donated", Value = "Donated"},
new SelectListItem { Text = "Bought", Value = "Bought"}
};
lot of time in app so i decided to move it into a repository class.
public class Repository
{
public List<SelectListItem> GetOriginList()
{
List<SelectListItem> originItems = new List<SelectListItem>
{
new SelectListItem { Text = "Born", Value = "Born"},
new SelectListItem { Text = "Donated", Value = "Donated"},
new SelectListItem { Text = "Bought", Value = "Bought"}
};
return originItems;
}
Then tried to access it.
public class CowController : Controller
{
Repository repository = new Repository();
ActionResult Create() {
ViewBag.origin = repository.GetOriginList();
return View();
}
}
My View
#Html.DropDownList("Origin", "Select Origin")
But it view me run time error.
An exception of type 'System.InvalidOperationException' occurred in System.Web.Mvc.dll but was not handled in user code
Additional information: The ViewData item that has the key 'Origin' is of type 'System.Collections.Generic.List`1[[System.Web.WebPages.Html.SelectListItem, System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]' but must be of type 'IEnumerable<SelectListItem>'.
Works fine when hard coded on action only.
Am i forgetting any type conversion??
Worked When I replaced using System.Web.WebPages.Html;
with using System.Web.Mvc.
I do not know the technical difference.. but if you have same problem you can try my solution...
It would be great if someone could comment with an technical difference...
Another takeaway when i included both reference.
Error 1 'SelectListItem' is an ambiguous reference between 'System.Web.WebPages.Html.SelectListItem' and 'System.Web.Mvc.SelectListItem'
Theres an error there, the case from origin. ViewBag uses dynamic types, then this will not throw any error in compilation time, but in runtime if something is wrong.
ViewBag.origin = repository.GetOriginList();
But you calling the DropDownList
#Html.DropDownList("Origin", "Select Origin")
Its case sensitive, you should change
ViewBag.origin to ViewBag.Origin
or call it:
#Html.DropDownList("origin ", "Select Origin")
EDIT:
Change the Repository function too:
public IEnumerable<SelectListItem> GetOriginList()

Plugin controllers, StructureMap and ASP.NET MVC

I'm using ASP.NET MVC (1.0) and StructureMap (2.5.3), I'm doing a plugin feature where dll's with controller are to be picked up in a folder. I register the controllers with SM (I am able to pick it up afterwards, so I know it's in there)
foreach (string file in path)
{
var assy = System.Reflection.Assembly.LoadFile(file);
Scan(x =>{
x.Assembly(assy);
x.AddAllTypesOf<IController>();
});
}
My problem is with the GetControllerInstance method of my override of DefaultControllerFactory. Everytime I send in enything else than a valid controller (valid in the sense that it is a part of the web project) I get the input Type parameter as null.
I've tried setting up specific routes for it.
I've done a test with Castle.Windsor and there it is not a problem.
Can anyone point me in the right direction? I'd appreciate it.
[Edit]
Here is the code:
-> Controller factory for Windsor
public WindsorControllerFactory()
{
container = new WindsorContainer(new XmlInterpreter(
new ConfigResource("castle")));
// Register all the controller types as transient
// This is for the regular controllers
var controllerTypes =
from t in
Assembly.GetExecutingAssembly().GetTypes()
where typeof(IController).IsAssignableFrom(t)
select t;
foreach (Type t in controllerTypes)
{
container.AddComponentLifeStyle(t.FullName, t,
LifestyleType.Transient);
}
/* Now the plugin controllers */
foreach (string file in Plugins() )
{
var assy = System.Reflection.Assembly.LoadFile(file);
var pluginContr =
from t in assy.GetTypes()
where typeof(IController).IsAssignableFrom(t)
select t;
foreach (Type t in pluginContr)
{
AddToPlugins(t);
/* This is the only thing I do, with regards to Windsor,
for the plugin Controllers */
container.AddComponentLifeStyle(t.FullName, t,
LifestyleType.Transient);
}
}
}
-> StructureMap; adding the controllers:
public class PluginRegistry : Registry
{
public PluginRegistry()
{
foreach (string file in Plugins() ) // Plugins return string[] of assemblies in the plugin folder
{
var assy = System.Reflection.Assembly.LoadFile(file);
Scan(x =>
{
x.Assembly(assy);
//x.AddAllTypesOf<IController>().
// NameBy(type => type.Name.Replace("Controller", ""));
x.AddAllTypesOf<IController>();
});
}
}
}
-> Controller factory for SM version
Not really doing much, as I'm registering the controllers with SM in the earlier step
public SMControllerFactory()
: base()
{
foreach (string file in Plugins() )
{
var assy = System.Reflection.Assembly.LoadFile(file);
var pluginContr =
from t in assy.GetTypes()
where typeof(IController).IsAssignableFrom(t)
select t;
foreach (Type t in pluginContr)
{
AddPlugin();
}
}
}
Can you post your controller factory?
I don't understand why Castle would work since I would think you would also get null passed in for the Type param of GetControllerInstance regardless of the DI framework you use inside that method. MVC is in charge of matching up the string name of the controller in the URL with a real type (unless you overrode those methods too). So I'm guessing it isn't the DI framework, but that MVC can't find your controller classes for some reason.

Resources