Due to problems with the encryptions I resend the message, and a couple of
clarifications:

 

Using this:

var section = this.services.ContentManager.New<SectionPart>( typeof(
SectionPart ).Name );

 

I’m now able to create the “section part” instance and bind it to the view
updating my module:

 

                               public int UpdateFrom1()

                               {

 
ContentDefinitionManager.AlterTypeDefinition( typeof( SectionPart ).Name,

                                                               cfg => cfg

 
.WithPart( "SectionPart" )

 
.WithPart( "RoutePart" )

 
.WithPart( "CommonPart" )

 
.WithPart( "MenuPart" )

 
.Indexed()

                                               );

 

                                               return 2;

                               }

 

a new question on this side: I need to be able to “link” the “section part”
to the Orchard main menu, how can I have a “show on main menu” checkbox?

 

.m

___________________________________

Mauro Servienti  | Microsoft MVP - Visual C#

MCTS /MCPD­ | IM: [email protected]

 

From: Mauro Servienti [mailto:[email protected]] 
Sent: mercoledì 10 novembre 2010 14:34
To: '[email protected]'
Subject: Clarifications about IRspository<> and IContentManager

 

Hi all,

 

I’m approaching Orchard for the first time, what I’d like to achieve is:

 

-          Create a “Section” module to define the concept of “sections”;

-          Being able to have an admin area for sections;

-          Being able to “attach” created sections to Orchard main menu;

-          Being able within the site template to take decisions based on
the current section;

 

Currently I’ve defined my “Section Module”, the module is build and is
running in Orchard. I have an admin menu within the Dashboard and from the
AdminController I’m trying to list all the sections.

 

What I’ve not understood is the difference between these approaches:

 

var data = this.repository.Table.ToList();

var allSections = this.contentManager.Query<SectionPart,
SectionRecord>().List();

 

if I manually add some rows to the database the first approach works fine
but the second one returns no data.

 

On the other side in order to create a “new” section I’m doing this:

 

var section = this.services.ContentManager.New<SectionPart>( typeof(
SectionPart ).Name );

 

but what I obtain is an “invalid cast exception”.

 

I’m taking as an example the “Orchard.Chapter” module, my Orchard version is
0.8.51.

 

Thanks in advance,

.m

___________________________________

Mauro Servienti  | Microsoft MVP - Visual C#

MCTS /MCPD­ | IM: [email protected]

 



---
You are currently subscribed to orchard-discuss as: [email protected].
To unsubscribe send a blank email to 
[email protected]

Reply via email to