Cannot query contentmanager for custom part

Topics: Customizing Orchard
Apr 29, 2014 at 11:37 PM
I'm trying to query the contentmanager for a part/record combination which I created but I receive the following error:
could not resolve property: EndpointRecord of: Orchard.ContentManagement.Records.ContentItemRecord
I created the part and record like so:

SchemaBuilder.CreateTable("EndpointRecord", table => table
            .ContentPartRecord()
            .Column("Name", DbType.String)
            .Column("MasterEndpointId", DbType.Int32)
        );


        ContentDefinitionManager.AlterPartDefinition(typeof(EndpointPart).Name, cfg => cfg
          .Attachable());

        ContentDefinitionManager.AlterTypeDefinition("Endpoint", cfg => cfg
            .WithPart(typeof(TitlePart).Name)
            .WithPart(typeof(EndpointPart).Name)
            .Creatable(false));

I haven't created any records yet, but the following should at least run properly right?
var endpoints = _contentManager.Query<EndpointPart, EndpointRecord>().List();
This is the stacktrace I receive:
An unhandled exception has occurred and the request was terminated. Please refresh the page. If the error persists, go back
could not resolve property: EndpointRecord of: Orchard.ContentManagement.Records.ContentItemRecord
NHibernate.QueryException: could not resolve property: EndpointRecord of: Orchard.ContentManagement.Records.ContentItemRecord at NHibernate.Persister.Entity.AbstractPropertyMapping.ToType(String propertyName) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Persister\Entity\AbstractPropertyMapping.cs:line 37 at NHibernate.Loader.Criteria.CriteriaQueryTranslator.GetPathInfo(String path) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Loader\Criteria\CriteriaQueryTranslator.cs:line 451 at NHibernate.Loader.Criteria.CriteriaQueryTranslator.CreateCriteriaEntityNameMap() in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Loader\Criteria\CriteriaQueryTranslator.cs:line 378 at NHibernate.Loader.Criteria.CriteriaQueryTranslator..ctor(ISessionFactoryImplementor factory, CriteriaImpl criteria, String rootEntityName, String rootSQLAlias) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Loader\Criteria\CriteriaQueryTranslator.cs:line 73 at NHibernate.Loader.Criteria.CriteriaLoader..ctor(IOuterJoinLoadable persister, ISessionFactoryImplementor factory, CriteriaImpl rootCriteria, String rootEntityName, IDictionary`2 enabledFilters) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Loader\Criteria\CriteriaLoader.cs:line 37 at NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Impl\SessionImpl.cs:line 1948 at NHibernate.Impl.CriteriaImpl.List(IList results) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Impl\CriteriaImpl.cs:line 265 at NHibernate.Impl.CriteriaImpl.List[T]() in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Impl\CriteriaImpl.cs:line 277 at Orchard.ContentManagement.DefaultContentQuery.Slice(Int32 skip, Int32 count) in \src\Orchard\ContentManagement\DefaultContentQuery.cs:line 162 at Orchard.ContentManagement.DefaultContentQuery.ContentQuery`1.Orchard.ContentManagement.IContentQuery<T>.List() in \src\Orchard\ContentManagement\DefaultContentQuery.cs:line 212 at ServiceDown.Orchard.Services.Controllers.ServiceEndpointAdminController.Index(PagerParameters pagerParameters) at lambda_method(Closure , ControllerBase , Object[] ) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass13.<InvokeActionMethodWithFilters>b__10() at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
What am I doing wrong here?