But cant make it work for umbraco 7 - by changing few variables and etc getting many different errors, nothing in particular.
Like :
-UCommerce.Presentation.Web.Controls.Adapters.MediaControlAdapter
-An invalid or incomplete configuration was used while creating a SessionFactory.
-UCommerce.EntitiesV2.MappingAssemblyTag
and etc.
Maybe someone has working console application example for umbraco 7 ? or have idea how to make it work.
It contains a test project that can access the database with read and write. You need to work on the session directly though. This way you avoid having the entire configuration. But this depends on the fact that you might or might not need some of the services. So to give a more exact answer, you need to explain exactly what you're trying to achieve.
We are trying to create standalone C# windows console application that would connect to the ucommerce, and import, update,delete - categories, products, images and etc based on other data we are getting.
The main issue because we want to create console application and not api call on the server, macro script or something similar, is because we had some experiences that running such scripts (to update,delete and etc with lots of data) on same server, with same application pool/solution starts to crash the solution itself, getting it slow, not finding cache and etc. that is why by wanted to avoid it we would prefer to have it like standalone application, since is going to run on some tens minute bases.
The problem is that when we take exactly the same application, and update connection string (to umbraco 7 database) and update references of umbraco.dll and umbraco.core.dll it does not work anymore.
I have checked you master classes example and it is not exactly what we are looking for, it uses sessions and same solution as main solution is linked to.
Then I just with updated references to new umbraco and ucommerce dll's.
Then it throws errors that it is missing some Casle.windrow and Castle.Core, FluentEnhibernate and nhgibernate.bytcode so i reference them from the 'old' application, since new ones does not have these.
What i get is
ComponentActivator: could not instantiate UCommerce.EntitiesV2.Repository`1[[UCommerce.EntitiesV2.PurchaseOrder, UCommerce, Version=3.5.0.13098, Culture=neutral, PublicKeyToken=null]]
If i try some other .net version, or some mix from old and new references.
I get all kind of random errors :
Like :
-An invalid or incomplete configuration was used while creating a SessionFactory.
-UCommerce.EntitiesV2.MappingAssemblyTag and etc.
I just need somehow to get this kind of console application - that would work with newest umbraco and ucommerce dll's.
That could be run manually, via scheduled task, and etc.
Any ideas ?
After some more tests and research I was able to make it work, using your suggestions - so i can get all the data - and that is great.
But is it possible using the this sessions method to Create product, create category, assign product to category and save everything and etc ?
Can you show some small example ?
That is why i prefer the console application example with components.config and etc so i could use entity methods to create and save products and etc.
The Save and Delete methods are just there for convenience. Using the lower level APIs is still a one liner for saving or deleting something.
You can easily save using the following method:
var sessionProvider = GetSessionProvider(); using (var session = sessionProvider.GetSession()) { var product = new Product(); session.SaveOrUpdate(product); session.Flush(); // Issue flush when you're done with all updates to issue commands to the database }
The BuiltIn is a flag we've added reasonly. You need to make sure the same version of uCommerce runs both in the database and the application. Otherwise stuff like that may happen.
When you have succesfully installed the uCommerce package in Umbraco, and can access the uCommerce backend. Then you know that the "UCommerce.Umbraco" assembly located in the bin folder of the web-site is working.
Please use that copy of the assembly.
Note also, that the "uCommerce.Umbraco.dll" is for Umbraco 4 and 6, while "uCommerce.Umbraco7.dll" is for Umbraco7. Please use the one appropriate for you version of Umbraco.
I am not quite sure what you mean by the comments regarding the CurrentCatalogName comment. But the name properties have not been part of uCommerce since version 3. You should use the CurrentCatalog property.
Umbraco 7 : ucommerce application
Hey, so for last half the day I am trying to create console application, that would connect with ucommerce.
Have found examples here : http://www.publicvoid.dk/UsingTheUCommerce3APIInAWindowsApplication.aspx
And it works great for umbraco 6 - tested it.
But cant make it work for umbraco 7 - by changing few variables and etc getting many different errors, nothing in particular.
Like : -UCommerce.Presentation.Web.Controls.Adapters.MediaControlAdapter -An invalid or incomplete configuration was used while creating a SessionFactory. -UCommerce.EntitiesV2.MappingAssemblyTag and etc.
Maybe someone has working console application example for umbraco 7 ? or have idea how to make it work.
Hi,
Where exactly do you see errors?
And what exactly are you trying to achieve with this?
You can clone our master class repository here:
https://bitbucket.org/uCommerce/ucommerce-master-class
It contains a test project that can access the database with read and write. You need to work on the session directly though. This way you avoid having the entire configuration. But this depends on the fact that you might or might not need some of the services. So to give a more exact answer, you need to explain exactly what you're trying to achieve.
Best regards
Morten
Hi,
Thank you for your help.
We are trying to create standalone C# windows console application that would connect to the ucommerce, and import, update,delete - categories, products, images and etc based on other data we are getting. The main issue because we want to create console application and not api call on the server, macro script or something similar, is because we had some experiences that running such scripts (to update,delete and etc with lots of data) on same server, with same application pool/solution starts to crash the solution itself, getting it slow, not finding cache and etc. that is why by wanted to avoid it we would prefer to have it like standalone application, since is going to run on some tens minute bases.
So we decided to create an application, like this one - what Soren made year ago : http://www.publicvoid.dk/UsingTheUCommerce3APIInAWindowsApplication.aspx With download link at the bottom.
The problem is that when we take exactly the same application, and update connection string (to umbraco 7 database) and update references of umbraco.dll and umbraco.core.dll it does not work anymore.
I have checked you master classes example and it is not exactly what we are looking for, it uses sessions and same solution as main solution is linked to.
Then I just with updated references to new umbraco and ucommerce dll's.
Then it throws errors that it is missing some Casle.windrow and Castle.Core, FluentEnhibernate and nhgibernate.bytcode so i reference them from the 'old' application, since new ones does not have these. What i get is ComponentActivator: could not instantiate UCommerce.EntitiesV2.Repository`1[[UCommerce.EntitiesV2.PurchaseOrder, UCommerce, Version=3.5.0.13098, Culture=neutral, PublicKeyToken=null]]
If i try some other .net version, or some mix from old and new references. I get all kind of random errors : Like :
-UCommerce.Presentation.Web.Controls.Adapters.MediaControlAdapter
-An invalid or incomplete configuration was used while creating a SessionFactory.
-UCommerce.EntitiesV2.MappingAssemblyTag and etc.
I just need somehow to get this kind of console application - that would work with newest umbraco and ucommerce dll's. That could be run manually, via scheduled task, and etc. Any ideas ?
If you just need the data API you can set up in a simpler way that doesn't require the full config to be present.
There's a working example at https://bitbucket.org/uCommerce/ucommerce-master-class/src/3bb3a79d4f76279fdbb9bc3e196d6f3d1794779b/src/MyUCommerceApp.Test/?at=default
Hi Soren,
After some more tests and research I was able to make it work, using your suggestions - so i can get all the data - and that is great. But is it possible using the this sessions method to Create product, create category, assign product to category and save everything and etc ? Can you show some small example ?
That is why i prefer the console application example with components.config and etc so i could use entity methods to create and save products and etc.
Hey guys, any ideas on this ?
Hi Villius,
The Save and Delete methods are just there for convenience. Using the lower level APIs is still a one liner for saving or deleting something.
You can easily save using the following method:
Hope this helps.
Hey Søren,
Thanks for your help. I am on it - will test it try it and let you know asap. Once again thanks.
Well quite close. How you would retrieve category definition ? I mean it works for product definitions - but does not want to work for category ones.
Tried : session.Query
Everything gives an error. To it seems to work for everything else. {"Invalid column name 'BuiltIn'."}
Edit : so it seems there so some incapability between database and entities. Added that table column as bit to the database. Now i can fetch them.
Hi Vilius,
Does this mean that you've sorted it out :) ?
The BuiltIn is a flag we've added reasonly. You need to make sure the same version of uCommerce runs both in the database and the application. Otherwise stuff like that may happen.
hi,
anyone know what happen this. I unable to load UCommerce. Umbraco. dll as (UCommerce version 6) a reference in visual studio 2012 or 2010.
Søren Spelling Lund you have any solution for this.
I want to Use SiteContext.Current.CatalogContext.CurrentCatalog method. But Older Commerce version in
SiteContext.Current.CatalogContext.CurrentCatalogName this wrong. Previous method come with commerce 6
I installed Umbraco 7.2 with commerce 6. I never change installed version and I want to immediate solution for this issue.
Hello,
When you have succesfully installed the uCommerce package in Umbraco, and can access the uCommerce backend.
Then you know that the "UCommerce.Umbraco" assembly located in the bin folder of the web-site is working.
Please use that copy of the assembly.
Note also, that the "uCommerce.Umbraco.dll" is for Umbraco 4 and 6, while "uCommerce.Umbraco7.dll" is for Umbraco7. Please use the one appropriate for you version of Umbraco.
I am not quite sure what you mean by the comments regarding the CurrentCatalogName comment. But the name properties have not been part of uCommerce since version 3. You should use the CurrentCatalog property.
Kind regards,
Jesper
is working on a reply...