How to extend the CMS where to start which class to extend or implement.

Sep 28, 2010 at 6:44 AM

Hello kishore_reddy

Thank you very much for your help about setting up the CMS.

However, I try to add new feature to the CMS with new  model view controller and stuck with some following error

Server Error in '/' Application.

The type : ComLib.Web.Modules.Webboard.Webboard has not been registered in EntityRegistration

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: The type : ComLib.Web.Modules.Webboard.Webboard has not been registered in EntityRegistration

Source Error:

Line 583:        protected virtual EntityListViewModel<T> InternalIndex(int? page, bool allowEditDelete, Func<IEntityService<T>, int, PagedList<T>> executor)
Line 584:        {
Line 585:            IEntityService<T> service = EntityRegistration.GetService<T>();
Line 586:            int pageIndex = page == null ? 1 : (int)page;
Line 587:            PagedList<T> result = executor(service, pageIndex);


Source File: C:\Users\embarus\Desktop\CommonLibraryCMS_0.9.4.20_Sources_2\src\lib\CommonLibrary.Web.Lib\Controllers\EntityControllerBaseT.cs    Line: 585

Stack Trace:

[ArgumentException: The type : ComLib.Web.Modules.Webboard.Webboard has not been registered in EntityRegistration]
   ComLib.Entities.EntityRegistration.GetService(String typeFullName) in C:\Dev\Business\CommonLibrary.NET\CommonLibraryNet_LATEST\src\Lib\CommonLibrary.NET\EntityModel\Registration\EntityRegistration.cs:392
   ComLib.Entities.EntityRegistration.GetService() in C:\Dev\Business\CommonLibrary.NET\CommonLibraryNet_LATEST\src\Lib\CommonLibrary.NET\EntityModel\Registration\EntityRegistration.cs:299
   ComLib.Web.Lib.Controllers.EntityControllerBase`1.InternalIndex(Nullable`1 page, Boolean allowEditDelete, Func`3 executor) in C:\Users\embarus\Desktop\CommonLibraryCMS_0.9.4.20_Sources_2\src\lib\CommonLibrary.Web.Lib\Controllers\EntityControllerBaseT.cs:585
   ComLib.Web.Lib.Controllers.EntityControllerBase`1.Index(Nullable`1 page) in C:\Users\embarus\Desktop\CommonLibraryCMS_0.9.4.20_Sources_2\src\lib\CommonLibrary.Web.Lib\Controllers\EntityControllerBaseT.cs:254
   lambda_method(Closure , ControllerBase , Object[] ) +145
   System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +51
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +409
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +52
   System.Web.Mvc.<>c__DisplayClassd.<InvokeActionMethodWithFilters>b__a() +127
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +436
   System.Web.Mvc.<>c__DisplayClassf.<InvokeActionMethodWithFilters>b__c() +61
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +305
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +830
   System.Web.Mvc.Controller.ExecuteCore() +136
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +111
   System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +39
   System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__4() +65
   System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +44
   System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +42
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +141
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +54
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +52
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8836913
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184



Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

 

I tried to simplify webboard feature by output only message to see if it work integrated with the CMS. 

I am very appreciate if you could add new feature or module (ie. Task List) and describe it step by step. I think it must be

the great article for people who want to extend the CMS.

If it 's not convenient for you just let me know how to extend and which class do I need to implement and where register some class.

 

Thank you very much.

Coordinator
Oct 1, 2010 at 5:06 PM

Hello,

I'm writing up documentation on this codeplex site wiki for the cms.

I'll be uploading the docs today on the wiki first and also as a .html file that is part of the source code.

Thanks.

-Kishore

Coordinator
Oct 1, 2010 at 7:24 PM

Embarus,

I've added documentation for Widgets and Modules in the Documentation tab. I'm continuing the documentation but this a start. Also take a look at the Configuration section.

As per your question on the classes to extend, I'm writing that up now in the Modules section. Should be done shortly.

- Kishore

Oct 9, 2010 at 3:40 AM

Kishore, thank you very much.

Oct 9, 2010 at 3:48 AM

Kishore, Thann you for your documentation.

It’ s useful, easy to follow and help me a lot to create my own module.

Actually, I created simple module for learning creating-custom module.
The module ‘s data table has only two field Id and Name to make it simple.

After crating model view controller for customer, I debugged program and point to

/customer/details/1

And the does not return customer name.

I tried to check if there is problem in repository class and wonder if I don’t have to override and put sql statement or LINQ to Entity to access database in public override Customer Get(int id) since the repository derives from RepositorySql<Customer>

The base class can do internally to get customer from id

 

 

 

 public override Customer Get(int id)

        {

            Customer entity = base.Get(id);

 

            return entity;

        }

 

I also attach source file and please could you check it out if I forgot or do something wrong.

Just click this link to download file.

 

Thank you very much for your kindness

Oct 16, 2010 at 11:10 AM

Solved !!

I've added CommonLibrary.NET source to debug the CMS and found the problem with RowMapper.

I passed the wrong field name.

 

public partial class CustomerRowMapper : EntityRowMapper<Customer>, IEntityRowMapper<Customer>
    {


        public override Customer MapRow(IDataReader reader, int rowNumber)
        {
            Customer entity = _entityFactoryMethod == null ? Customer.New() : _entityFactoryMethod(reader);
            entity.Id = reader["Id"] == DBNull.Value ? 0 : (int)reader["Name"];
            entity.Name = reader["Name"] == DBNull.Value ? string.Empty : reader["Name"].ToString();

            return entity;
        }


    }

 

Anywhere, thank you very much for your contribute of great ASP.NET MVC CMS