RC 4.0 : register a module

Posted by Community Admin on 03-Aug-2018 16:05

RC 4.0 : register a module

All Replies

Posted by Community Admin on 02-Dec-2010 00:00

Hello,

I'm a new sitefinity user and I follow the tutorial named "how to create a module". But when I register it, it is not visible in the content back office menu?

Have you any idea?

Thanks

Jocelyn

Posted by Community Admin on 02-Dec-2010 00:00

Hi jocelyn payneau,

Can you please try setting the StartType to OnFirstCall and restarting the application?

Best wishes,
Radoslav Georgiev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 02-Dec-2010 00:00

Thanks for answering. To restart the application what do i need to do? Close my browser and restart my website? My website is still in test under Visual Studio Web Server not IIS.

Jocelyn

Posted by Community Admin on 02-Dec-2010 00:00

Hello jocelyn,

You can just make a dummy change in the web.config and/or build the project in Visual Studio. Then run the project again.

Best wishes,
Ivan Dimitrov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 03-Dec-2010 00:00

Hello,

The install method is started but I have the following error:
Unsupported language "fr-FR". If you want to support this language, please configure your application accordingly.

Is it Sitefinity language? or other language?

Thanks

Posted by Community Admin on 03-Dec-2010 00:00

Hi jocelyn,

Do you try to change the CurrnetUICulutre with some code? Currently we do not support specific cultures and from the stack trace it looks like you have some custom code were you are trying to use a specific culture.

All the best,
Ivan Dimitrov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 03-Dec-2010 00:00

Hi,

I managed to install it despite an execution error "Licensing page...".

I have one question about dynamic data. Where fields are saved? In which database table?

Thanks

Jocelyn

Posted by Community Admin on 03-Dec-2010 00:00

Hello jocelyn,

It depends on for which type you have created a dynamic data. Is there are reason for looking into the database table rather than using the API or some services?

Kind regards,
Ivan Dimitrov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 03-Dec-2010 00:00

Hello,

I was talking about this method coming from the how to create a basic module with rc4:

private void EnsureMetaFields(ref bool restart)
        
            bool changedDB = false;
  
            App.WorkWith().DynamicData().Type(typeof(Document))
  
                .Field().TryCreateNew("FirstName", typeof(string), ref changedDB).Done()
                .Field().TryCreateNew("LastName", typeof(string), ref changedDB).Done()
                .Field().TryCreateNew("Phone", typeof(string), ref changedDB).Done()
                .Field().TryCreateNew("HowDidYouHear", typeof(string), ref changedDB).SaveChanges(true);
  
            if (changedDB)
            
                restart = changedDB;
            
        

Here is an extract from the pdf tutorial:
"Using the Fluent API you create the dynamic fields, which hold the input values submitted by the user. The installation of the module proceeds in case the fields already exist. If the fields did not exist prior to this update, the system restarts, in order for the database schema changes to take effect. "

What does that mean? I understand that when it installs, database is updated with this 4 fields. No?

Is there some specific documentation about dynamic data? When developing a module, I can store data in the database not using dynamic data?

Posted by Community Admin on 07-Dec-2010 00:00

Hi jocelyn payneau,

Let me start with a few words on creating modules. Right now we are implementing a bare-bones module for 4.0 and removing all things that might impede an end user. This module should be available for the official release, and if not - for one of the weekly builds after it.

About "dynamic data", modules and Sitefinity.
Sitefinity uses OpenAccess for persistence. Generally, ORMs work around a fixed model (e.g. specially decorated classes, xml-s, mapping db tables to classes, etc). In Sitefinity, we use the so called forward mapping feature of OpenAccess, which means that we have C# classes and OpenAccess generates SQL tables for them.

Working with the data layer of Sitefinity involves working with managers or fluent API. The natural way is to use the c# properties and set some values to them. This means that you are using real properties that are compiled in the assemblies. This is static, or fixed, data. If this is all you need, you don't have to use dynamic data (i.e. most of the users).

The so-called "dynamic data", which we internally call "meta data", allows you to create new tables, or add new fields to database tables and use them without having to recompile Sitefinity to use new c# properties. You access the new database fields with extension methods - GetValue(propertyName) and SetValue(propertyName, newValue). Notice that you are no longer using C# properties, but you are specifying names of properties that do not exist in the original model class (e.g. NewsItem). That is why we call those special properties "dynamic". In a similar way, you can access the new tables you create by specifying a name of a class that does not really exist in any of the Sitefinity assemblies.

While dynamic data is an easy way to extend existing persistent types, you do not have to use it to create a new model, or to work with the database at all. It is preferred to create your own persistent types over dynamic types, because you can set collations on the fields, create constraints and indices - all of which will boost your performance (and in the case of collation - enables proper sorting).

And, let us move to the first part of your question. As I explained, the fluent API for dynamic data creates new tables and/or columns in the database. We use OpenAccess's forward mapping feature, which means it internally maps C# types and C# fields to database tables and database columns. When you create new columns/tables, that mapping is no longer valid. That is why we have to "restart" Sitefinity (and more importantly, OpenAcces' connection to the database engine), so that mapping is "renewed" and is aware of the new tables/columns.

The answer to the second part of your question is that you do not have to use dynamic types/fields in order to work with the database. Simply use the regular fluent API and/or managers.

Kind regards,
Dido
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 07-Dec-2010 00:00

Hello,

Thanks for your answer. It's very useful to understand Sitefinity's architecture and api.

For modules I have to develop i have a specific data model. So I should not use Dynamic Data, but Fluent API or managers. I read your documentation about Fluent API.

To build a custom module, I should have a fluent class inherited from Fluent API (telerik.Sitefinity.Fluent.Contentitem), and another class which maps the data model?

Can you give me the architecture and files' organization of a custom module based on Fluent API?

Thanks

Jocelyn PAYNEAU

Posted by Community Admin on 08-Dec-2010 00:00

Hello jocelyn,

There is a base class from which your custom facade should inherit BaseFacade

public class TestFacade : BaseFacade
  
      #region Constructors
 
      /// <summary>
      /// Initializes a new instance of the <see cref="TestFacade"/> class.
      /// </summary>
      /// <param name="appSettings">
      /// The app settings that configure the way fluent API will function.
      /// </param>
      public TestFacade(AppSettings appSettings)
      
          if (appSettings == null)
              throw new ArgumentNullException("appSettings");
          this.appSettings = appSettings;
      
 
      /// <summary>
      /// Initializes a new instance of the <see cref="TestFacade"/> class.
      /// </summary>
      /// <param name="appSettings">The app settings.</param>
      /// <param name="itemID">The item id.</param>
      public PageFacade(AppSettings appSettings, Guid itemID)
          : this(appSettings)
      
          if (itemID == Guid.Empty)
              throw new ArgumentNullException("itemID");
 
          this.LoadItem(itemID);
 
      
 
      
  #endregion
 
      #region Properties
 
      /// <summary>
      /// Gets an instance of the <see cref="TestManager"/> to be used by this facade.
      /// </summary>
      /// <value>An initialized instance of the <see cref="TestManager"/> class.</value>
      public virtual TestManager TestManager
      
          get
          
              if (this.testManager == null)
                  this.testManager = testManager.GetManager(this.appSettings.TestProviderName, this.appSettings.TransactionName);
              return this.testManager;
          
      
 
      #endregion
 
      #region Public Methods
 
      #region Create Methods
 
            .....
               .....

There are the following base abstract classes that you can use

BaseContentPluralFacadeWithLifeCycle - Base class for facades that manage a set of items and support content lifecycle
BaseContentSingularFacadeWithLifeCycle -  Base class for facades that manage single content items that support content lifecycle
BaseDraftFacade - ase class for facades that manage the draft lifecycle state of a content item
BasePublicFacade - Base class for facades that manage the public state of a content item

The above facades expect object of type Content. If you have a custom object you hae use

BaseFacadeWithManager

Best wishes,
Ivan Dimitrov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 08-Dec-2010 00:00

Hello Ivan & Dido,

We're planning on launching in 4.0 in January and would need the module release starter kit before mid-January.

Regarding Not using DataDynamic API and instead using our won data types and using Fluetn API and/or the managers......

1. How is the module organized ?
2. Is there documentation on How to use Fluent API and managers ?
3. What is the organisation around this API, facade and manager ?
4. How should these elements communicate between each other ?
5. How can we interact with these elements from a view ?
6. Also, what is the best way to manipulate the data (insert, update requests...) ? 
7. How should we connect to the databsse - how to use Sitefinity's feature for this ?
8. Is there an example of a module with complete source code and an explanation about the development?

Any Information you could supply on this would be most appreciated.

Regards,
Chuck.

Posted by Community Admin on 15-Dec-2010 00:00

Hello Susan,

We have developed a sample custom module which we will provide as a separate download. This module is compatible only with the latest release that is coming with a whole bunch of new features. We are planning  to provide the new release and this module some time next week (20-24/Dec). We will include initial documentation(but not finalized) how the module was built. In the initial documentation you will receive answers to your questions.

Greetings,

Nikolay Datchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 29-Mar-2011 00:00

Dido, seen your answer i can see that is able to create a database with a different collation that comes by default?, (E.g from accent-insentive to accent-sensitive)?

regards,

Omar

Posted by Community Admin on 01-Apr-2011 00:00

Hello Omar,

The dynamic data  works with fields, but by default OA does not support setting the collation. You have to do it manually.

Kind regards,
Ivan Dimitrov
the Telerik team

This thread is closed