getting null trying to call a service

Very beginning of writing this..but cant get past this null error...Please look....

I get a null on DependencyResolver.Current.GetService<iContactEntityEditService>()

namespace WebSite.Controllers
    public class ContactController : AppController
        private SystemLogHandler _systemLog = new SystemLogHandler(System.Reflection.Assembly.GetExecutingAssembly());
        public ActionResult ContactEntityEdit()

            GenericGrids genericGrid = null;
            ContactEntityEditViewModel vm = new ContactEntityEditViewModel();

            vm.GridName = "contactEntity-crud";
            vm.SiteName = vm.UserSessionVariables.SiteName;

            vm.SiteCode = vm.UserSessionVariables.SiteCode;
            vm.SiteId = vm.UserSessionVariables.SiteId;          

            string sessionId = this.AppService.UserSessionVariables.SessionId.ToString();

            iContactEntityEditService sv = GetService<iContactEntityEditService>();            
            genericGrid = sv.GetGenericGridInfo("contactEntity-crud", sessionId);

            vm.ContactEntityEditViewModel.HeaderTextLeft = "Contact Entity Editor";
            vm.ContactEntityEditViewModel.Icon = (genericGrid.HeaderIcon.StartsWith("fa-") ? "fa " : "") + genericGrid.HeaderIcon;

            return View("ContactEntityEdit", vm);

        protected static T GetService<T>()
            return (T)GlobalConfiguration.Configuration.DependencyResolver.GetService(typeof(T));

Open in new window

LVL 11
Robb HillSenior .Net DeveloperAsked:
Who is Participating?
AndyAinscowFreelance programmer / ConsultantCommented:
Just what is iContactEntityEditService ?
You might be getting a null returned because there isn't one of those available.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.