1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Intermediate module fails registration

Intermediate module fails registration

3 posts, 0 answered
  1. bemara57
    bemara57 avatar
    135 posts
    Registered:
    27 Mar 2008
    25 Jan 2011
    Link to this post
    I used the Visual Studio template called "Sitefinity Intermediate Module" to create a new module. I registered the module through the Admin, but the new module does not show up in the admin menu pages. After running it in debug mode though, I see that it crashes silently here:

    public static SamplesManager GetManager(string providerName, string transactionName)
    {
        return ManagerBase<SamplesDataProviderBase>.GetManager<SamplesManager>(providerName, transactionName);
    }

    This is the exception:

    ==================================
    System.Reflection.TargetInvocationException was unhandled by user code
      Message=Exception has been thrown by the target of an invocation.
      Source=mscorlib
      StackTrace:
           at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
           at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
           at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
           at System.Activator.CreateInstance[T]()
           at Telerik.Sitefinity.Data.ManagerBase`1.GetManager[T](String providerName, String transactionName)
           at Telerik.Sitefinity.Data.ManagerBase`1.GetManager[T](String providerName)
           at MyNamespace.Samples.SamplesManager.GetManager(String providerName)
      InnerException: Telerik.OpenAccess.Exceptions.ConfigurationException
           HelpLink=http://www.telerik.com/help/openaccess-orm/using-configuration-files-for-class-libraries.html
           Message=Cannot find section 'backendconfiguration' with id 'mssqlConfiguration'.
    See History property for more details.
           Source=Unity_ILEmit_DynamicClasses
           CanRetry=true
           History=Resolving connection with id='BootstrapConnection'
    Config file=(Database.Get parameter)
    Check <openaccess> node
    Found connection node with id='BootstrapConnection'
    Connection node is not empty
    Found backendconfigurationname='mssqlConfiguration'
    Resolving backendconfiguration id='mssqlConfiguration'
    Checking assembly MyNamespace.Samples, Version=1.0.4041.33623, Culture=neutral, PublicKeyToken=null
    Backend configuration not resolvable.
           StackTrace:
                at DynamicModule.ns.Wrapped_OpenAccessSamplesDataProvider_1982cc9024a4434692587d7663326bb6.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 MyNamespace.Samples.SamplesManager..ctor(String providerName)
                at MyNamespace.Samples.SamplesManager..ctor()
           InnerException: 
    ============================

  2. bemara57
    bemara57 avatar
    135 posts
    Registered:
    27 Mar 2008
    26 Jan 2011
    Link to this post
    Just figured out... that the App.config file has to be set as an embedded resource. Bingo!!
  3. Vincent
    Vincent avatar
    41 posts
    Registered:
    21 Sep 2007
    26 Jan 2011
    Link to this post
    Hi Bemara57,

    Using the Intermediate Module sample in the SDK, I have a similar exception on this code :

    public static JobsManager GetManager(string providerName)
    {
        return ManagerBase<JobsDataProviderBase>.GetManager<JobsManager>(providerName);
    }

    Tested your workaround with App.Config but no luck, I am having an exception, although the SDK Sample application seems to work quite well.

    The inner exception from my side is :
    Mapping for class 'Jobs.Model.JobApplication' is specified in file 'config' but the class could not be found. 

    This exception is different after replacing the namespace of the model class (that is Jobs.Model in the SDK) by JobsIntermediate.Model as follows :

    <mappings current="mssqlMapping">
      <mapping id="mssqlMapping">
        <namespace name="JobsIntermediate.Model">
          <class name="JobApplication">

    In this case I have the exception :
    "Persistence-capable-superclass 'Telerik.Sitefinity.GenericContent.Model.Content' not declared in meta data. --> JobsIntermediate, Version=1.0.4043.29228, Culture=neutral, PublicKeyToken=null/namespace[JobsIntermediate.Model]/class[JobsIntermediate.Model.JobApplication]"}

    So doesn't work for me, but have noticed that sometimes the exception is not fired.

    Secondly I have not been able to make a project work with the VS template SitefinityIntermediateModule. I have found a lot of errors in the code to be fixed by hand and the postbuild execution of VEnhance.exe in the csproj file is just not working. Even after having set everything as similar as the SDK sample, I have not able to create any module table in the Sitefinity database.
    My solution has been to copy the SDK Intermediate sample module and to replace class names and smoothly modify the code to fit my needs. The exception when application starts is always throwing but I can create datat in the database.

    Thirdly, it is always really difficult for me to get the module registered and working in the Sitefinity application.
    Each time, I have to register and unregister the module and restart again and again the application or the IIS.
    I understand that some interaction is done when the application starts but I don't really understand why should I have to run so much attempts before it may works.

    It would be helpful to have an up-todate documentation including the App.Config file and a working template.

    Regards

    Vincent



3 posts, 0 answered