Interaction with aspx.NET application and/or another Database

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
1 anno tempo fa
Using 4.50 version
I would like to find the proper way for nopcommerce interaction with my aspx.NET application
To get the idea - there is a list of software products that we want to sell (downloadable) and there are some actions that we need to accomplish after user is registered (only once) and before he downloaded the bought software (once per each software product):
A/ create user in our system, inform user about it (e-mail is ID and password should be the same)
B/ register user in product N dedicated workspace (there are several steps to be done - define what working space user can access, create a sample project for him etc)
For the moment there is an aspx.NET application which handles all this with SQL Server Database behind (we also use SQL Server database when user works in these software products)

Questions
1/ For each software product I need to define a kind of application specific settings which will be used when doing B/ - where it is appropriate to store this information in nopcommerce and how make it available for reading and using?
2/ How do I reuse my code of aspx.net application? Direct calls to dll methods?
3/ Probably I should establish direct connection to my Database - how can I do it using nop commerce 4.50? This question was already asked many years ago - see
https://www.nopcommerce.com/en/boards/topic/33377/nopcommerce-connect-two-databases but since then everything has changed - so what is a new way to establish another database connection and use it when needed?
1 anno tempo fa
I recommend that you
a) Modify your "aspx.NET application" to handle a web service call
b) Create a plugin for nopCommerce that calls the web service.  You can handle "events" to deal with customer registered and order completed.
1 anno tempo fa
New York wrote:
I recommend that you
a) Modify your "aspx.NET application" to handle a web service call
b) Create a plugin for nopCommerce that calls the web service.  You can handle "events" to deal with customer registered and order completed.

Thank you for the hint, following this way I stumbled on the problem - after plugin installation (!), restart application and new user registration (I introduced a new event with needed parameters on user registration), I got an exception
Exception: 
Autofac.Core.DependencyResolutionException: An exception was thrown while activating λ:Nop.Services.Events.IConsumer`1[[Nop.Core.Domain.Customers.CustomerRegisteredEvent2, Nop.Core, Version=4.5.0.0, Culture=neutral, PublicKeyToken=null]][] -> Nop.Plugin.RegisterInfo.User.Services.EventConsumer.
---> Autofac.Core.DependencyResolutionException: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Nop.Plugin.RegisterInfo.User.Services.EventConsumer' can be invoked with the available services and parameters:
Cannot resolve parameter 'Nop.Plugin.RegisterInfo.User.Services.UserRegisterInfoManager userRegisterInfoManager' of constructor 'Void .ctor(Nop.Plugin.RegisterInfo.User.Services.UserRegisterInfoManager)'.

Very strange - I saw the same problem but for not installed plugins https://www.nopcommerce.com/en/boards/topic/48201/consuming-event-by-not-installed-plugin while in my case it is after plugin installation and restart
Any ideas?
1 anno tempo fa
Post your event code. In the meantime you can check this link https://stackoverflow.com/questions/31477287/autofac-exception-cannot-resolve-parameter-of-constructor-void-ctor
1 anno tempo fa
Rashed Khan wrote:
I have looked through other plugins and found a NopStartup class where plugins register their services! Did it for my plugin and the problem dissappeared but nothing was caught by plugin...
1 anno tempo fa
Now I stumbled on a "classical" problem - dlls used by plugin are not copied to Plugins/bin folder - never ever and as a result I got
An unhandled exception of type 'System.IO.FileLoadException' occurred in System.Private.CoreLib.dll
Could not load file or assembly 'MyDll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, processorArchitecture=x86'. The given assembly name or codebase was invalid. (0x80131047)
1 anno tempo fa
polbotinka77 wrote:
Now I stumbled on a "classical" problem - dlls used by plugin are not copied to Plugins/bin folder - ....

Moreover they are not copied into Plugins/MyPlugin folder - only Nop.Plugin.XXX.XXX.dll
1 anno tempo fa
If you are referring to 3rd party dll's, then maybe this will help. Put the setting in your .csproj file.  (See the SendinBlue pugin as an example)
  <PropertyGroup>
...
    <!--Set this parameter to true to get the dlls copied from the NuGet cache to the output of your project.
    You need to set this parameter to true if your plugin has a nuget package
    to ensure that the dlls copied from the NuGet cache to the output of your project-->
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
  </PropertyGroup>
1 anno tempo fa
New York wrote:
If you are referring to 3rd party dll's, then maybe this will help. Put the setting in your .csproj file.  (See the SendinBlue pugin as an example)
  <PropertyGroup>
...
    <!--Set this parameter to true to get the dlls copied from the NuGet cache to the output of your project.
    You need to set this parameter to true if your plugin has a nuget package
    to ensure that the dlls copied from the NuGet cache to the output of your project-->
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
  </PropertyGroup>

Sure, I did it. I noticed that during solution build plugin 3rd party dlls are all copied (!) but then removed (?on afterbuild?) so that when nop.web is being build there are no 3rd party dlls in the plugin folder
1 anno tempo fa
New York wrote:
If you are referring to 3rd party dll's, then maybe this will help. Put the setting in your .csproj file.  (See the SendinBlue pugin as an example)

I compare exactly with this Plugin - SendinBlue
- after SendinBlue Plugin Rebuild - Nop.Web/Plugins/Misc.Sendinblue contains only 6 + 1 dll
- after MyPlugin Rebuild - Nop.Web/Plugins/XXX.YYY contains all stuff System, Microsoft, runtime, language, nopcommerce, my dlls - nothing is removed (unlike SendinBlue)
and as soon as I build Nop.Web
- SendinBlue is left as is
- MyPlugin is cleaned up - only 1 plugin dll is left
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.