Всего сообщений:
2
Карма:
10
Присоединился:
28.05.2012
Страна:
United States
Hi everybody, My client ask me something who seems me very simple to do. He has nopcommerce 1.9 web site , and he wish develop a simple windonws forms application to modify clients adresses. So i tryed to configure a news windows forms project : static void Main(string[] args) { // Code that runs on application startup NopConfig.Init(); //initialize IoC IoC.InitializeWith(new DependencyResolverFactory()); //initialize task manager TaskManager.Instance.Initialize(NopConfig.ScheduleTasks); TaskManager.Instance.Start(); //open new FormClient().Show(); TaskManager.Instance.Stop(); } Then i create a service manager who expose data : public class ServiceManager { public ICustomerService CustomerService; public ServiceManager() { var dbContext = IoC.Resolve<NopObjectContext>(); CustomerService = new CustomerService(dbContext); } } And impossible to acess CustomerService methods because resolve methode don't find the concrete classe to instiate for NopObjectContext; Is somebody can show me ? THANKS IN ADVANCE (you can find nop commerce 1.9 in this location : http://nopcommerce.codeplex.com/downloads/get/176949 )
Всего сообщений:
2
Карма:
10
Присоединился:
28.05.2012
Страна:
United States
Finally , it works : App.config must be : <?xml version="1.0"?> <configuration> <configSections> <section name="NopConfig" type="NopSolutions.NopCommerce.BusinessLogic.Configuration.NopConfig, Nop.BusinessLogic" requirePermission="false"/> <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <section name="NopSolutions.NopCommerce.BusinessLogic.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> </sectionGroup> </configSections> <appSettings> <add key="dependencyResolverTypeName" value="NopSolutions.NopCommerce.BusinessLogic.Infrastructure.UnityDependencyResolver, Nop.BusinessLogic" /> </appSettings> <connectionStrings> <add name="NopEntities" connectionString="metadata=res://*/Data.NopModel.csdl|res://*/Data.NopModel.ssdl|res://*/Data.NopModel.msl;provider=System.Data.SqlClient;provider connection string="Data Source=EGG-BANKS;Initial Catalog=nopvierge2;Persist Security Info=True;User ID=sa;Password=sqlserver;MultipleActiveResultSets=True;Application Name=EntityFramework"" providerName="System.Data.EntityClient" /> <add name="NopSqlConnection" connectionString="Data Source=DAVID-TOSH\SQLEXPRESS;Initial Catalog=nop;Integrated Security=True;Persist Security Info=False;MultipleActiveResultSets=True;Connect Timeout=120" /> </connectionStrings> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup> <applicationSettings> <NopSolutions.NopCommerce.BusinessLogic.Properties.Settings> <setting name="Nop_BusinessLogic_Clickatell_PushServerWS" serializeAs="String"> <value>http://api.clickatell.com/soap/webservice_vs.php</value> </setting> <setting name="Nop_BusinessLogic_EuropaCheckVatService_checkVatService" serializeAs="String"> <value>http://ec.europa.eu/taxation_customs/vies/services/checkVatService</value> </setting> </NopSolutions.NopCommerce.BusinessLogic.Properties.Settings> </applicationSettings> <NopConfig> <SqlServer ConnectionStringName="NopSqlConnection"/> <ScheduleTasks> <Thread seconds="60"> <!--do NOT enable ClearCache task if you have enabled tracking online users--> <task name="ClearCache" type="NopSolutions.NopCommerce.BusinessLogic.Caching.ClearCacheTask, Nop.BusinessLogic" enabled="false" stopOnError="false"/> <task name="PurgeOnlineUsers" type="NopSolutions.NopCommerce.BusinessLogic.Audit.UsersOnline.PurgeOnlineUsersTask, Nop.BusinessLogic" enabled="true" stopOnError="false"/> <task name="Emails" type="NopSolutions.NopCommerce.BusinessLogic.Messages.SendQueuedMessagesTask, Nop.BusinessLogic" enabled="true" stopOnError="false" maxTries="5"/> <task name="KeepAlive" type="NopSolutions.NopCommerce.BusinessLogic.Utils.KeepAliveTask, Nop.BusinessLogic" enabled="true" stopOnError="false" path="keepalive/ping.ashx"/> </Thread> <Thread seconds="600"> <task name="DeleteExpiredCustomerSessions" type="NopSolutions.NopCommerce.BusinessLogic.CustomerManagement.DeleteExpiredCustomerSessionsTask, Nop.BusinessLogic" enabled="true" stopOnError="false" deleteExpiredCustomerSessionsOlderThanMinutes="43200"/> <task name="DeleteExpiredShoppingCarts" type="NopSolutions.NopCommerce.BusinessLogic.Orders.DeleteExpiredShoppingCartsTask, Nop.BusinessLogic" enabled="false" stopOnError="false" deleteExpiredShoppingCartsOlderThanMinutes="259200"/> </Thread> <Thread seconds="60"> <task name="UpdateExchangeRates" type="NopSolutions.NopCommerce.BusinessLogic.Directory.ExchangeRates.UpdateExchangeRateTask, Nop.BusinessLogic" enabled="true" stopOnError="false"/> </Thread> <Thread seconds="3600"> <task name="DatabaseMaintance" type="NopSolutions.NopCommerce.BusinessLogic.Maintenance.DatabaseMaintanceTask, Nop.BusinessLogic" enabled="false" stopOnError="false"/> </Thread> </ScheduleTasks> </NopConfig> </configuration> with program.cs file : static void Main(string[] args) { // Code that runs on application startup NopConfig.Init(); //initialize IoC IoC.InitializeWith(new DependencyResolverFactory()); //initialize task manager TaskManager.Instance.Initialize(NopConfig.ScheduleTasks); TaskManager.Instance.Start(); new form1().show(); TaskManager.Instance.Stop(); }