New Products Sample - Not Complete?

Posted by Community Admin on 05-Aug-2018 22:36

New Products Sample - Not Complete?

All Replies

Posted by Community Admin on 14-Jan-2011 00:00

Hi There,

I just started to look at the code for the new Products module and noticed that there are references to "News" all over the place. Obviously this sample was based on the built in News module but it would appear that what was included is far from being converted over. The references to "news" in comments in the code isn't a big deal but there are many other places where it's pointing to News ascx templates (that aren't provided i.e. internal const string titlesOnlyLayoutTemplateName = "Telerik.Sitefinity.Resources.Templates.Frontend.News.TitlesOnlyListView.ascx"; in the file MasterListView.cs) and things like:

static ProductItem()
    // set default values
    permissionsetObjectTitleResKeys = new Dictionary<string, string>()
    
         ProductsConstants.Security.PermissionSetName, "NewsActionPermissionsListTitle"
    ;
Which I would think could even possibly cause conflicts using the name name for keys in both modules? 

As I said I'm just starting to look into this but I'm not going to waste any more of my time if this is actually not completed or the wrong code was included in the release. Can someone from Telerik clarify so we know if this is as good as it gets or if there's a cleaner version on the way.

Thanks,
Phill

Posted by Community Admin on 19-Jan-2011 00:00

Hello Phill Hodgkinson,

The products module is complete, but, as you can see, there are things that are not cleared yet.

ISecuredObject.PermissionsetObjectTitleResKeys is not yet documented. It is used like this:

Since the "General" permission set is widely used for different items, one might want to differentiate them in the UI. For example, in the "permissions" dialog, one might want to see "View this blog" instead of just "View".

The "syntax" of permissionsetObjecTitleKeys is something like

     "Supported permission set name": "Key in SecurityResources"

The key is looked up in SecurityResources and replaced like "View/edit/modify/create this 0".

Since the products module defines its own resources for security actions (see ProductsModule.InstallCustomPermissions and look up "ViewProducts" in ProductsResource), you can leave permissionsetObjecTitleKeys as either empty or null.

Kind regards,
Dido
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.

Posted by Community Admin on 19-Jan-2011 00:00

Hi,

We have already implemented several modules based on the Products module. Most of the things work fine, except the Taxonomies. They are just not working.
If you add a Category or Tag to a product item, but it is not saved or loaded.
Also the filters by taxonomy is not working.

//Kiril

Posted by Community Admin on 19-Jan-2011 00:00

Hi,

I tried to run the sitefinity website in sdk example solution and I'm getting an exception from ProductManager.GetManager(string providerName) function. I debuged and found that providerName parameter is an empty string, not sure if this is the problem. Can some one help me to get this working. I want to develop a custom module and first want to see how the products module is implemented and working.

one other thing is...i changed the app.config of the products module to point to the correct database instance in my working environment.

Exception type: TargetInvocationException.
Inner Message: Field 'UrlName_' of class 'Telerik.Sitefinity.GenericContent.Model.Content' is described as compiled and artificial at the same time. --> Telerik.Sitefinity.Model, Version=4.0.1098.0, Culture=neutral, PublicKeyToken=b28c218413bdf563/namespace[Telerik.Sitefinity.GenericContent.Model]/class[Telerik.Sitefinity.GenericContent.Model.Content]/field[UrlName_]

Also this exception....

Persistence-capable-superclass 'Telerik.Sitefinity.GenericContent.Model.Content' not declared in meta data. --> ProductCatalogSample, Version=1.0.4036.18724, Culture=neutral, PublicKeyToken=null/namespace[ProductCatalogSample.Model]/class[ProductCatalogSample.Model.ProductItem]

Thanks!

Posted by Community Admin on 20-Jan-2011 00:00

I have managed to fix one of the issues
- Tags and Categories are now saved
Here is how:
The module installer doesn't call InstallTaxonomies method on a installation where the previousSystemVersion is different from 0 (Thank you Reflector!)
This becomes the end of the 

public override void Install(SiteInitializer initializer)

this.InstallCustomWorkflow(initializer);
this.InstallCustomPermissions();
this.InstallTaxonomies(initializer);

But even when the InstallTaxonomies is called the Taxonomies are not saved for some reason.
so InstallTaxonomies becomes 
protected override void InstallTaxonomies(SiteInitializer initializer)
    base.InstallTaxonomy(initializer, typeof(CaseStudy));
    initializer.Context.MetadataManager.SaveChanges(false);

This creates the metadata fields for Categories and Tags to the Model

This still doesn't resolve the problem with Filtering the the Custom item by Category or Tag

//Kiril

Posted by Community Admin on 24-Jan-2011 00:00

I am getting the same error as Duneel when I try to reuse the Product Module (inheriting it). I think I hosed the database. Any idea what this could be from?

Server Error in '/' Application.

Field 'UrlName_' of class 'Telerik.Sitefinity.GenericContent.Model.Content' is described as compiled and artificial at the same time. --> Telerik.Sitefinity.Model, Version=4.0.1098.0, Culture=neutral, PublicKeyToken=b28c218413bdf563/namespace[Telerik.Sitefinity.GenericContent.Model]/class[Telerik.Sitefinity.GenericContent.Model.Content]/field[UrlName_]

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: Telerik.OpenAccess.Exceptions.MetadataException: Field 'UrlName_' of class 'Telerik.Sitefinity.GenericContent.Model.Content' is described as compiled and artificial at the same time. --> Telerik.Sitefinity.Model, Version=4.0.1098.0, Culture=neutral, PublicKeyToken=b28c218413bdf563/namespace[Telerik.Sitefinity.GenericContent.Model]/class[Telerik.Sitefinity.GenericContent.Model.Content]/field[UrlName_]

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[MetadataException: Field 'UrlName_' of class 'Telerik.Sitefinity.GenericContent.Model.Content' is described as compiled and artificial at the same time. --> Telerik.Sitefinity.Model, Version=4.0.1098.0, Culture=neutral, PublicKeyToken=b28c218413bdf563/namespace[Telerik.Sitefinity.GenericContent.Model]/class[Telerik.Sitefinity.GenericContent.Model.Content]/field[UrlName_]]
   DynamicModule.ns.Wrapped_OpenAccessMembershipProvider_4b00f6fbda094382b600901add4ec12e.Initialize(String providerName, NameValueCollection config, Type managerType) +284
   Telerik.Sitefinity.Data.ManagerBase`1.InstantiateProvider(IDataProviderSettings providerSettings, Type providerType, ExceptionPolicyName policy, ManagerBase`1 manager) +2706
   Telerik.Sitefinity.Data.ManagerBase`1.InstantiateProvider(IDataProviderSettings providerSettings, ExceptionPolicyName policy, ManagerBase`1 manager) +117
   Telerik.Sitefinity.Data.ManagerBase`1.SetProvider(String providerName, String transactionName) +407
   Telerik.Sitefinity.Data.ManagerBase`1..ctor(String providerName, String transactionName) +249
   Telerik.Sitefinity.Security.UserManager..ctor(String providerName, String transactionName) +39

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle._InvokeConstructor(IRuntimeMethodInfo method, Object[] args, SignatureStruct& signature, RuntimeType declaringType) +0
   System.RuntimeMethodHandle.InvokeConstructor(IRuntimeMethodInfo method, Object[] args, SignatureStruct signature, RuntimeType declaringType) +15
   System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +281
   System.Reflection.ConstructorInfo.Invoke(Object[] parameters) +17
   Telerik.Sitefinity.Data.ManagerBase`1.GetManager(String providerName, String transactionName) +1323
   Telerik.Sitefinity.Security.UserManager.GetManager(String providerName, String transactionName) +41
   Telerik.Sitefinity.Security.SecurityManager.LogoutImpl(String providerName, Guid userId, String userName, Credentials credentials) +73
   Telerik.Sitefinity.Security.SecurityManager.Logout(String providerName, Guid userId) +178
   Telerik.Sitefinity.Security.SecurityManager.Logout() +257
   Telerik.Sitefinity.Security.Web.UI.LogoutForm.DoLogout(String navigateUrl) +33
   Telerik.Sitefinity.Security.Web.UI.LogoutForm.SwitchUserButton_Command(Object sender, CommandEventArgs e) +32
   System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +115
   System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +169
   System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +9
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +176
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563


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

Posted by Community Admin on 25-Jan-2011 00:00

Hi,

@Duneel Muthubandara

I think I described in the module documentation that Sitefinity does not use that app.config. You should NOT specify the connection string there. Sitefinity uses only the connection strings defined in /DataConfig/ConnectionStrings.

@Basem Emara

Again, in the module documentation I tried to explain how a module should be configured.The app.config of your persistent should start like this

<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="openaccess" type="Telerik.OpenAccess.Config.ConfigSectionHandler, Telerik.OpenAccess.Config, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342" requirePermission="false" />
  </configSections>
  <openaccess xmlns="http://www.telerik.com/OpenAccess">
    <references>
      <!-- Do not add any references here, as they are added dynamically by Sitefinity
      and it will be duplicated-->    
    </references>

Notice the comment. It is extremely important NOT to include any references there. Sitefinity merges information about meta types, it's own app.config for Telerik.Sitefinity.Model.dll and all your persistent module's app.configs. Every type knows which assembly it comes from (MetaType.AssemblyName). If you hard-code any reference there, you will get the error you've just received.I believe it is the same for Duneel Muthubandara. Please, TURN OFF open access visual studio integration. In the documentation it is explained how to configure the project to build with the proper version of OpenAccess, and which features to turn off, and how to enhance the assembly.

@Kiril Jovchev

Site modules are initialized on the first request to sitefinity. The Bootstrapper is called, then SiteInitializer gose over the registerd modules and initializes. All modules share the same global named transaction, and therefore, if anything fails, the module won't be installed.
Please, reastrain from committing anything in the module initialization. Doing so might render your system unusable (especially if something goes wrong with meta types). The condition to save the meta types (e.g. Tags and Categories meta fields) is that everything went smoothly. Remove the SaveChanges, as SiteInitializer, and more preciesly, its InstallContext, takes care of this.
Failures are wrapped in try-catch so that the system is protected from going unusable if one of the modules fails installing. Therefore, you should debug the module and look for the exception that is thrown (this is the only case when install context doesn't save).

Best wishes,
Dido
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.

Posted by Community Admin on 25-Jan-2011 00:00

Hi Dido

I had filed 2 tickets for the Products module, and your support guys have been really helpfull and they spoted 2 bugs:
The install bug is next one in ProductsModule.cs:

        pageInfo.Parameters["ModuleName"] = ProductsModule.ModuleName;
        var comments = new BackendContentView() ControlDefinitionName = ProductsDefinitions.BackendCommentsDefinitionName ;
        initializer.CreatePageFromConfiguration(pageInfo, moduleNode, comments);
    
The highlighted moduleNode should be productsNode 

And the next bug was with that Taxonomy filters were not working
So the bug is in Data\ProductsDataProvider.cs
public override IEnumerable GetItemsByTaxon(Guid taxonId, bool isSingleTaxon, string propertyName, Type itemType, string filterExpression, string orderExpression, int skip, int take, ref int? totalCount)
    if (itemType == typeof(ProductItemUrlData))
    
        this.CurrentTaxonomyProperty = propertyName;
The highlighted ProductItemUrlData should be ProductItem.

May be you guys from Telerik should consider to put the version of the module with fixes for download, or may a sicky for a while?

Kiril Jovchev
Software Architect
UOMA OY | Merimiehenkatu 36 D | FI-00150 Helsinki | www.uoma.fi



Posted by Community Admin on 26-Jan-2011 00:00

Thanks Dido for all your help (and Kiril :). The Products Module is all there and complete. It is just a matter of setting it all up correctly. For example, I just figured out that the App.config file has to be set as an embedded resource (http://goo.gl/AREMY).

Kinda bumpin heads without the documents for this one though. In the latest Jan 14th SDK, the "getting start" screen says "soon" for the "Create a module with OA" documentation. That should shed light on many things.

Posted by Community Admin on 26-Jan-2011 00:00

Ah-hah!! The documents is in a Word doc in the Products Module project folder (it's obviously excluded from the solution view). Nice!!!

Posted by Community Admin on 15-Feb-2011 00:00

Hey guys,

Since you seem to be much into this products module: how can I add some more custom fields to it?
What would be the steps to do this?

Thanks,
Daniel

Posted by Community Admin on 15-Feb-2011 00:00

Hey Daniel,

The way I went about figuring that out was to do a search for all instances of "whatsinthebox", one of the custom fields that Telerik added for the sample. I then duplicated and renamed all instances, that's a bit simplified but you know what I mean. One thing I've encountered is that if I add one field, install the module to see if it works and then try to add another it won't install the second time and there's no uninstall method. So be sure to do this on a test DB and backup the test db before the install and do a restore before each time you try to add any new data fields.

Hope that helps, if not later this evening (EST) I can dig through and tell you what files were modified specifically.

Cheers,
Phill

Posted by Community Admin on 15-Feb-2011 00:00

Hi Phill,

Thanks for the explanation.
Well, that seems quite a lot of work for some fields :(

For now, I'm still struggling with the bugs mentioned in this post: saving taxonomies and filtering on them. 
Can't get them to work. 

Maybe I'm the only one having such problems with these custom modules, but it took quite a while before I had installed this ProductsModule. And now I have the same problem with the Migration module. It just doesn't shows up in the menu. Frustrating!

Anyway, I'll try your suggestions.

Thanks!
Daniel

Posted by Community Admin on 15-Feb-2011 00:00

Hi Daniel,

If you want I can zip up my Products Module code and send to you. I've added some simple custom fields (ItemNumber, ModelNumber, etc) in addition to what Telerik had added. I've also added the fixes that Kiril has supplied as well. You can email me at phillh at pbnj [dot] ca  and I'll send you a zip, might help you get a jump start.

Regards,
Phill

Posted by Community Admin on 15-Feb-2011 00:00

Hi,

I was able to get the Products module working in the sample solution came with the SDK. Now I wanted to create my own module and install within the same sample sitefinity website. I modified the SystemConfig.config to have an entry for the new module exactly the same way as for the Products module. I launched the website and foundout that nothing has been created for the new module (not even the back-end database tables sfex_ and sfx_). Can someone help me on how I should trigger module installation which creates everythings and show the module name under Content menu in sitefinity administration?

Thanks!
Duneel

Posted by Community Admin on 15-Feb-2011 00:00

Hi Duneel,

I don't have a complete answer to your problem but I know that if you have an error in your code that when it tries to install the module it will fail and nothing will be done. This is actually a nice feature, especially since modules can't be un-intstalled, as it prevents broken modules from being installed. The thing I'm not much help on is I don't know if the errors are logged anywhere or what the best way to trouble shoot is. I think if you put a breakpoint in at your module installation method you might be able to step through and find out what's going on.

Hope that helps a bit.

Cheers,
Phill

Posted by Community Admin on 16-Feb-2011 00:00

Hi Phill,

I debuged the code and the execution is not coming to the Install functions. However Module.Initialize function gets executed. Another question is do we need to copy the app.config file of the custom module over to the bin of website along with the dll? I saw it has some database connection settings and does that has to be pointing to the same database instance? Is there a way I can share the complete module project with you?

I tried to install the Products sample module on a different site and it is not getting installed and create the back-end tables in the new db. it works only with the database came with the sdk (Sitefinity.mdf).

Thanks!
Duneel

Posted by Community Admin on 16-Feb-2011 00:00

Hi Duneel

Did you register the module in Settings->Advanced->System->ApplicationModules?

//Kiril

Posted by Community Admin on 16-Feb-2011 00:00

Hi Kiri,

Yes I did register from the administration section and also tried by manully adding the entry to the SystemConfig.config file and no difference. The Initilize function of the module gets executed and that means the module is installed right. but not of the install functions get called. I'm also receiving a TargetInvocationException and I can strill continue and load the website. This exception is thrown from the sample products module too. I've uploaded the source code of my module to sendspace.com and it can be downloaded from the link below. You'll have to fix the references and venhance paths.

http://www.sendspace.com/file/2cgzqz

Thanks!
Duneel

Posted by Community Admin on 16-Feb-2011 00:00

Hi Duneel

Try putting some try catch blocks in Initialize and you might catch the exception that is generated somewhere deep. Or look at SF4 log, You can setup one from web config

<system.diagnostics>
   <trace autoflush="true">
     <listeners>
       <add name="Text"
            type="System.Diagnostics.TextWriterTraceListener"
            initializeData="messages.log" />
     </listeners>
   </trace>
 </system.diagnostics>

//Kiril

Posted by Community Admin on 16-Feb-2011 00:00

Hi Kiril,

Below is the same exception i'm receiving from products module too. Do you know what could be the reason? Also I have the following few questions.

1. Is the products sample module is fully completed?
2. Can we install the products module on a fresh SF4 website runs on a fresh database (initialized by SF when the initial run)?
3. Is registering the module through Administration->Advance->System->ApplicationModule is sufficient?

Thanks,
Duneel

Timestamp: 2/16/2011 3:08:53 PM
  
Message: HandlingInstanceID: 66f7f329-b63e-4c04-a8ae-096833c5556f
An exception of type 'System.Reflection.TargetInvocationException' occurred and was caught.
-------------------------------------------------------------------------------------------
02/16/2011 10:08:53
Type : System.Reflection.TargetInvocationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : Exception has been thrown by the target of an invocation.
Source : Telerik.Sitefinity
Help link : 
Data : System.Collections.ListDictionaryInternal
TargetSite : Telerik.Sitefinity.Data.IManager GetManager(System.Type, System.String)
Stack Trace :    at Telerik.Sitefinity.Data.ManagerBase.GetManager(Type managerType, String providerName)
   at Telerik.Sitefinity.Data.ManagerBase.GetManager(Type managerType)
   at Telerik.Sitefinity.Modules.PersistentTypesReporsitory.GetModuleKnownTypes(IModule module)
   at Telerik.Sitefinity.Modules.PersistentTypesReporsitory.RegisterPersistentTypesForModule(IModule module, InstallContext context)
   at Telerik.Sitefinity.Services.SystemManager.InitializeModule(ModuleSettings settings, InstallContext installContext, Boolean start)
  
Additional Info:
  
MachineName : DUNEEL7
TimeStamp : 2/16/2011 3:08:53 PM
FullName : Telerik.Sitefinity.Utilities, Version=4.0.1160.0, Culture=neutral, PublicKeyToken=b28c218413bdf563
AppDomainName : 9fffb664-1-129423425126094139
ThreadIdentity : 
WindowsIdentity : PAVLIKS\dmuthubandara
Requested URL : /
    Inner Exception
    ---------------
    Type : Telerik.OpenAccess.Exceptions.MetadataException, Telerik.OpenAccess, Version=2010.3.1125.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342
    Message : Persistence-capable-superclass 'Telerik.Sitefinity.GenericContent.Model.Content' not declared in meta data. --> ProductCatalogSample, Version=1.0.4064.16164, Culture=neutral, PublicKeyToken=null/namespace[ProductCatalogSample.Model]/class[ProductCatalogSample.Model.ProductItem]
    Source : Unity_ILEmit_DynamicClasses
    Help link : 
    ErrorId : 0
    ClassName : Telerik.Sitefinity.GenericContent.Model.Content
    FieldName : 
    TableName : 
    ColumnName : 
    AmbiguousValue : 
    DisambiguatedValue : 
    FileName : 
    ProjectName : 
    IndexName : 
    ConstraintName : 
    ProcedureName : 
    PreviousDefiner : 
    Context : --> ProductCatalogSample, Version=1.0.4064.16164, Culture=neutral, PublicKeyToken=null/namespace[ProductCatalogSample.Model]/class[ProductCatalogSample.Model.ProductItem]
    Usage : 
    Column : 0
    Line : 0
    IsWarning : False
    HelpKeyword : 
    InnerExceptions : 
    FailedObject : 
    BackendError : 
    Reason : Runtime
    CanRetry : True
    Data : System.Collections.ListDictionaryInternal
    TargetSite : Void Initialize(System.String, System.Collections.Specialized.NameValueCollection, System.Type)
    Stack Trace :    at DynamicModule.ns.Wrapped_OpenAccessProvider_b092fda689ac4eadbeaa99fdbe87543f.Initialize(String providerName, NameValueCollection config, Type managerType)
       at Telerik.Sitefinity.Data.ManagerBase`1.InstantiateProvider(IDataProviderSettings providerSettings, Type providerType, ExceptionPolicyName policy, ManagerBase`1 manager)
       at Telerik.Sitefinity.Data.ManagerBase`1.InstantiateProvider(IDataProviderSettings providerSettings, ExceptionPolicyName policy, ManagerBase`1 manager)
       at Telerik.Sitefinity.Data.ManagerBase`1.SetProvider(String providerName, String transactionName)
       at Telerik.Sitefinity.Data.ManagerBase`1..ctor(String providerName, String transactionName)
       at Telerik.Sitefinity.Data.ManagerBase`1..ctor(String providerName)
       at Telerik.Sitefinity.Modules.GenericContent.ContentManagerBase`1..ctor(String providerName)
       at ProductCatalogSample.Data.ProductsManager..ctor(String providerName) in C:\Program Files (x86)\Telerik\Sitefinity 4.0\Samples\CS\Products\Data\ProductsManager.cs:line 34
       at ProductCatalogSample.Data.ProductsManager..ctor() in C:\Program Files (x86)\Telerik\Sitefinity 4.0\Samples\CS\Products\Data\ProductsManager.cs:line 25

Posted by Community Admin on 16-Feb-2011 00:00

Hi Duneel

It looks like your model has not been registered.
The build action for the app.config must be "Embedded Resource", and are you running the VEnhance to add the model info to the assembly?

//Kiril

Posted by Community Admin on 16-Feb-2011 00:00

Hi Kiri,

The App.Config file in the module is already set as an Embedded Resource. The VEnhance path is correctly set in the project file. Would you be able to give a try with the module source code I uploaded and get back to me please?

Thanks!

Posted by Community Admin on 16-Feb-2011 00:00

Hi,

I made a try too of Products module.
I successfully register my own module through Administration.

But I encounter a problem with App.config, it's cleary connections configuration in Openaccess who cause troubles.
Originally we have this :
<openaccess xmlns="www.telerik.com/OpenAccess">
    <references>
      <!-- Do not add any references here, as they are added dynamically by Sitefinity
      and it will be duplicated-->     
    </references>
    <connections>
      <connection id="DatabaseConnection1">
        <databasename>Database1</databasename>
        <servername>(local)\SQLEXPRESS</servername>
        <integratedSecurity>True</integratedSecurity>
        <backendconfigurationname>mssqlConfiguration</backendconfigurationname>
      </connection>
    </connections>
....
</openaccess>

But i don't get how editing this part, in Sitefinity site connection string are already define into DataConfig.config.

@Duneel => Hi, i see your messages. For verify if your module are really register you can look in SecurityConfig.config, normally Products module create customs permission.

Posted by Community Admin on 16-Feb-2011 00:00

Hi Nicholas,

Did you try on a fresh instance? Does it create all the back-end tables when you registered the module?

Thanks!

Posted by Community Admin on 16-Feb-2011 00:00

I had a hard time reinstalling my module, so I always restored the database to a point before the initial install. I also had to restore the ~/App_Data/Sitefinity folder completely. We will just have to wait until the Uninstall and Upgrade events are implemented.

I successfully replicated the Products Module and wrote a blog about it. I even included the fixes in this thread. Check it out:
http://www.sitefinity.com/marketplace/modules/falafel-contacts-module-for-sitefinity-4.aspx

I hope this sheds some more light. I am really looking forward to the Q1 update on this.

Posted by Community Admin on 17-Feb-2011 00:00

Hi Duneel,

i'm on a fresh instance, i just start on Sitefinity ;-).
The Backend tables doesn't create, but i just verify ContentViewConfig.config and config:link for module aren't generated.

I think my connection configuration in App.config module is bad, it results InitializeDefaultViews in ProductsConfig.cs doesn't work well and don't construct backend part.

I made connections like this :

<connections>
  <connection id="DatabaseConnection1">
    <databasename>MyBase</databasename>
    <servername>SRV100\MS02</servername>
    <integratedSecurity>True</integratedSecurity>
    <backendconfigurationname>mssqlConfiguration</backendconfigurationname>
  </connection>
</connections>

But I just got in response when I register the module and restart application this exception :
Telerik.OpenAccess: No enhanced assembly has been found for meta-data construction. This may be caused by a missing app.config file (use app.config as embedded resource then) or by an insufficient references section in the configuration file (add the referenced enhanced assemblies there too) or by a wrong enhancement setting; please check your configuration.

My App.config is configured as an embedded resource.

Regards

Nicolas

Posted by Community Admin on 17-Feb-2011 00:00

Hi Nicolas,

It looks like the class library is not enhanced. Please check the .csproj file and make sure that you have configured  VEnhance.exe.

All the best,
Ivan Dimitrov
the Telerik team

Posted by Community Admin on 17-Feb-2011 00:00

Hi Nicolas,

I got the products module working. Try with a fresh website with the default database settings (pointing to SQLExpress) and the app.config of the module should also have the default db settins (Database1 and SQLExpress). Verify the project file has been updated to reference VEnhance.

Once the dll is build copy over to the bin folder of the website and register the module through the admin screen. once done, update the web.config and re-save and refresh the page to trigger the module installation.

Cheers!
Duneel

Posted by Community Admin on 17-Feb-2011 00:00

Hi,

Thanks for your responses.

After investigation, the problem seems to be VEnhance. I follow process describe into documentation attached with module "Creating a custom module for Sitefinity 4.docx" but i don't success configure VEnhance.

When i try to build the module VEnhance cause an error type 3. If I test same line command into DOS it seems works.

<ProjectExtensions>
    <VisualStudio>
      <UserProperties OpenAccess_ConfigFile="App.config" OpenAccess_ConnectionId="DatabaseConnection1" OpenAccess_Enhancing="True" OpenAccess_UpdateDatabase="False" OpenAccess_EnhancementOutputLevel="1" />
    </VisualStudio>
  </ProjectExtensions>
  <PropertyGroup>
    <PostBuildEvent>
    </PostBuildEvent>
    <PreBuildEvent>
    </PreBuildEvent>
  </PropertyGroup>
  <!-- Telerik OpenAccess enhancement -->
  <Target Name="EnhanceAssembly" Condition="'$(_AssemblyTimestampBeforeCompile)'!='$(_AssemblyTimestampAfterCompile)'">
    <Copy SourceFiles="$(TargetPath)" DestinationFiles="$(TargetPath).notenhanced" />
    <Copy SourceFiles="$(PdbFile)" DestinationFiles="$(PdbFile).notenhanced" ContinueOnError="true" />
    <Message Text="$(TargetDir)" Importance="high" />
    <Exec IgnoreExitCode="False" WorkingDirectory="$(TargetDir)" Command=""..\DLLs\Sitefinity\VEnhance.exe" -verboseMode:2 "-config:$(ProjectDir)App.config" -signAssembly "-keyFile:$(ProjectDir)$(AssemblyOriginatorKeyFile)" "-assembly:$(TargetPath)"" Condition="'$(AssemblyOriginatorKeyFile)'!=''" />
    <Exec IgnoreExitCode="False" WorkingDirectory="$(TargetDir)" Command=""..\DLLs\Sitefinity\VEnhance.exe" -verboseMode:2 "-config:$(ProjectDir)App.config" "-assembly:$(TargetPath)"" Condition="'$(AssemblyOriginatorKeyFile)'==''" />
    <Copy SourceFiles="$(TargetPath)" DestinationFolder="$(IntermediateOutputPath)" />
    <Copy SourceFiles="$(PdbFile)" DestinationFolder="$(IntermediateOutputPath)" ContinueOnError="true" />
  </Target>
  <Target Name="PeVerify" Condition="'$(_AssemblyTimestampBeforeCompile)'!='$(_AssemblyTimestampAfterCompile)'">
   <GetFrameworkSdkPath>
      <Output TaskParameter="Path" PropertyName="SdkPath" />
    </GetFrameworkSdkPath>
    <Exec WorkingDirectory="$(SdkPath)bin" Command="peverify.exe /nologo "$(TargetPath)"" />
  </Target>
  <PropertyGroup>
    <PdbFile>$(OutDir)\$(AssemblyName).pdb</PdbFile>
    <RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
    <PrepareForRunDependsOn>
      $(PrepareForRunDependsOn);
      EnhanceAssembly;
      <!-- PeVerify -->
</PrepareForRunDependsOn>
  </PropertyGroup>


Regards,

Nicolas

Posted by Community Admin on 17-Feb-2011 00:00

Hi

I finally found the last problem, I'm really a noob :-).
I don't realize i have made a mistake in VEnhance path, i don't think folders number change after build.

Thanks to all for your help.

Regards,

Nicolas

Posted by Community Admin on 17-Feb-2011 00:00

Hi Phill,

I got my custom moduled registered and working in Sitifinity and now I have another problem. Not sure if you also came across the same.

When I go to create new item dialog, it loads with all the input fields and I'm receiving 2 javascripts alerts with "Undefined" as the message. And the buttons such as Publish, Draft..etc not appearing on the dialog. The more actions link is also not working. see the screenshot attached.

Is it a problem with the workflow? I've opened the workflow file in notepad and corrected the workflow file path. previously it was set to a wrong place (ex: C:\Feodorov\Projects\Sitefinity 4\SDK\Samples\CS\Products\ProductsWorkflow.xamlx). Otherthan that I couldnt find anything wrong with the workflow and it is being correctly referenced in the Module.cs file.

Can you or someone help me please to fix this issue? I cant perform save/edit/delete since I dont have the buttons.

Thanks!
Duneel

Posted by Community Admin on 17-Feb-2011 00:00

Hi,

in your custom item (in example ProductItem.cs) have you keep the region IApprovalWorkflowItem ?

#region IApprovalWorkflowItem members
/// <summary>
/// Gets or sets the approval tracking records
/// </summary>
[FieldAlias("approvalTrackingRecordMap")]
[NonSerializableProperty]
public ApprovalTrackingRecordMap ApprovalTrackingRecordMap
    get
    
        return this.approvalTrackingRecordMap;
    
    set
    
        this.approvalTrackingRecordMap = value;
    
 
/// <summary>
/// Gets or sets the current state of the item in the approval workflow.
/// </summary>
/// <value></value>
/// <remarks>
/// Note that item can be in different states depending on the culture.
/// </remarks>
[DataMember]
[Database(DBType = "VARCHAR", DBSqlType = "NVARCHAR")]
public virtual Lstring ApprovalWorkflowState
    get
    
        if (this.approvalWorkflowState == null)
        
            this.approvalWorkflowState = this.GetString("ApprovalWorkflowState");
        
        return this.approvalWorkflowState;
    
    set
    
        this.approvalWorkflowState = value;
        this.SetString("ApprovalWorkflowState", this.approvalWorkflowState);
    
#endregion


Regards,

Nicolas

Posted by Community Admin on 17-Feb-2011 00:00

Hi Nicolas,

I have the complete IApprovalWorkflowItem members region in my XYZItem.cs file.

Cheers!
Dunee;

Posted by Community Admin on 17-Feb-2011 00:00

Hi

the WorkflowConfig.config contains your XYZWorkflow after register module ?

<workflowsTypes>
    <add serviceUrl="~/Workflows/XYZ.xamlx" title="ModuleTitle" resourceClassId="XYZResources" contentType="Sitefinity.XYZ.Model.XYZItem" />
</workflowsTypes>

The xamlx file are embedded resource.

Regards,

Nicolas

Posted by Community Admin on 17-Feb-2011 00:00

Hi Nicolas,

Yes I have an entry in the Workflow.config file as below. ContactsList is my custom module.

<?xml version="1.0" encoding="utf-8"?>
<workflowConfig xmlns:config="urn:telerik:sitefinity:configuration" xmlns:type="urn:telerik:sitefinity:configuration:type" config:version="4.0.1160.0">
    <providers>
        <add version="4.0.1160.0" name="OpenAccessDataProvider" />
    </providers>
    <workflowsTypes>
        <add serviceUrl="~/Workflows/Contacts.xamlx" title="ModuleTitle" resourceClassId="ContactsResources" contentType="ContactsList.Model.ContactItem" />
    </workflowsTypes>
</workflowConfig>


Thanks
Duneel

Posted by Community Admin on 17-Feb-2011 00:00

Hi,

it's weird i have the same configuration and it's works here.

Regards,
Nicolas

Posted by Community Admin on 17-Feb-2011 00:00

Yes Nicolas, It is weird. I have uploaded the source code of my custom module. Could you please have a look? try registering the module in your sitefinity site. You will have to fix the broken references first.

You can download the source code from the link below.
http://www.sendspace.com/file/b0sqj5

The sample products module works without these issues.

Thanks,
Duneel

Posted by Community Admin on 17-Feb-2011 00:00

I will take a look to your module, if i found something i cameback to you.

Regards
Nicolas

Posted by Community Admin on 17-Feb-2011 00:00

Thanks and appriciate it Nicolas. Let me know if you find something.

Thanks!
Duneel

Posted by Community Admin on 17-Feb-2011 00:00

Hi Nicolas,

I figuredout what's was the problem. It was the bad Workflow.xamlx file. There were errors in it. I compared that file with the file in products module and fixed them. Now my module is fully functional. Yepppee!!

Thanks everyone for your help!

Duneel

Posted by Community Admin on 22-Feb-2011 00:00

Guys,

I need to create a custom module with few fields. I got the products module installed and studied the way it has been implement. I can reuse most of the code in products module to rebuild the new module I need. but I dont want the Title field to appear on the create new and edit forms. Can someone confirm whether it's doable? I believe the Title field is mandatory in any custom module. If not how can we remove that? I removed the field from the XXXDefinitions.cs file and now I'm getting other errors like URL field validation fails at the bottom.

Thanks,
Duneel

Posted by Community Admin on 24-Feb-2011 00:00

Hi Phill,

Is there is a way to findout the backend template markup for the generate Insert view of a custom module? I need to customize the way the individual fields are arranged and want to put some extra logic in the code behind and use that as an external template for the insert view.

Thanks,
Duneel

Posted by Community Admin on 25-Feb-2011 00:00

Hello Duneel,

When you install the SDK there is a folder with external templates -C:\Program Files (x86)\Telerik\Sitefinity SDK 4.0\Resources. All templates can be exported with Reflector as well.
I suggest that you should use custom fields instead of trying to modify the templates. Custom fields can be added from the UI and there is an option to create a custom controls that can be used as a fields in the view.

Kind regards,
Ivan Dimitrov
the Telerik team

Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!

This thread is closed