2007-10-17

Alen Ziver Malhasoglu's New Microsoft Commerce Server Blog

Using the CatalogSiteAgent in Applications hosted at Web Server

A good quote from Vinayak Tadas' blog:

Programming the Commerce Server 2007 catalog system:
Creating the CatalogContext


The objects in the catalog system can now be programmed in two modes. In the first mode the catalog server assembly is loaded in the callers appdomain (aka inproc mode). In the second mode the functionality of the catalog system is available remotely via the catalog web service. The programming model and the methods available in both the modes are the same. The only difference is in the way the CatalogContext object is created. The CatalogContext object is the root object in the catalog system. All other objects are obtained from the CatalogContext object.

1. The Inproc mode : You use this mode when you are running your code on the web server. The CatalogContext code is initialized by specifying the sitename. The following code sample shows how to create a CatalogContext in this mode. You need to add references to the Microsoft.Commerceserver.catalog, Microsoft.CommerceServer.CrossTierTypes and Microsoft.CommerceServer.Shared assemblies. The objects in the catalog system reside in the Microsoft.CommerceServer.Catalog and Microsoft.CommerceServer namespaces.

CatalogSiteAgent siteInfo = new CatalogSiteAgent();
siteInfo.SiteName = "StarterSite";
siteInfo.AuthorizationMode = AuthorizationMode.ThreadContext;
siteInfo.AuthorizationPolicyPath = @"E:\Inetpub\wwwroot\CatalogWebService\CatalogAuthorizationStore.xml";
siteInfo.IgnoreInventorySystem = false;
CacheConfiguration cacheConfiguration = new CacheConfiguration();
cacheConfiguration.CacheEnabled =true;
cacheConfiguration.SchemaCacheTimeout = new TimeSpan(0, 10, 0);
CatalogContext context = CatalogContext.Create(siteInfo, cacheConfiguration);

Use the CatalogSiteAgent class to specify the site name, the authorization information and the inventory usage option.

The AuthorizationMode enumeration has the following values
AuthorizationMode.NoAuthorization : Do not perform any authorization checks. This mode should be used on the runtime sites.
AuthorizationMode.ThreadContext : Before performing any operation ensure that the user is authorized to perform it. The identity of the user is obtained from the user's thread context. This mode should be used in Console applications.
AuthorizationMode.HttpContext : Before performing any operation ensure that the user is authorized to perform it. The identity of the user is obtained from the current Http context. This mode should be used in web applications where users update the catalog system.

The AuthorizationPolicyPath specifies the location of the authorization store. The authorization store is an Xml file which contains which information about the authorized users and the operations they can perform.

Commerce Server 2007 now adds an inventory integration with the catalog system.The inventory system now allows you to store the inventory information like (onhandquantities, status etc) for products and variants in the catalog system. You can use the IgnoreInventorySystem parameter to turn off inventory integration.If the inventory resource exists and IgnoreInventorySystem parameter is set to false no inventory operations or lookups will be performed by the catalog methods.

Use the CacheConfiguration object to specify the caching configuration. Note that caching is turned off by default and is enabled by setting the cacheConfiguration.CacheEnabled property.
If you are using the Microsoft.CommerceServer.Runtime BCL then you can specify the cache configuration and the inventory integration option in the web.config of your runtime site.

2. The WebService mode: The CatalogContext object can also be initialized in the webservice mode by passing in the url of the catalog webservice.
CatalogServiceAgent catalogServiceAgent = new CatalogServiceAgent(@"http://Servername/CatalogWebservice/CatalogWebservice.asmx");
CatalogContext context = CatalogContext.Create(catalogServiceAgent);

Use the CatalogServiceAgent class to specify the url of the catalog web service. The other overloads on this method allow you to specify the authentication methods and a credential prompter.
If you are wondering how to specify the authorization, caching and inventory option this is specified through the catalogWebService element in web.config. All the attributes and child elements are documented in the web.config itself.

Note: Even though the CatalogContext class has the CreateFromConnectionString method, it exists only for backward compatibility and is now deprecated.
Published Wednesday, August 30, 2006 12:15 AM by vinayakt
Filed under: Programming the Catalog System
Comments
# Implementing the credential prompter
I received a question on my earlier post on implementing the credential prompter. When connecting...
Wednesday, September 06, 2006 1:37 AM by Vinayak's WebLog
# Implementing the credential prompter
I received a question on my earlier post on implementing the credential prompter. When connecting to
Saturday, October 07, 2006 1:53 PM by Vinayak's WebLog
# Wade Wegner's Technical Blog - Programming with Commerce Server in two modes: InProc mode and Web Service mode
PingBack from http://blog.wadewegner.com/PermaLink,guid,23153f59-9c24-4941-a486-d1030b618b3e.aspx
Thursday, March 22, 2007 10:03 PM by Wade Wegner's Technical Blog - Programming with Commerce Server in two modes: InProc mode and Web Service mode

Web Application Stress Tool

Below we see a good tutorial about stress testing for web applications.
http://www.microsoft.com/technet/archive/itsolutions/intranet/downloads/webtutor.mspx?mfr=true

2007-10-08

Alen Ziver Malhasoglu's New Microsoft Commerce Server Blog

SplendidCRM - Creating a new Module

----- Original Message -----
From: Paul Rony
To: Ziver MALHASOGLU
Sent: Saturday, October 06, 2007 4:42 PM
Subject: RE: Creating a new Module

The place to start to build a module is with the SQL code. You will need some C# and ASP.NET files, but the core of SplendidCRM is data-driven.

Here are some of the generic steps:
Create a table using one of the existing tables in SQL Scripts\BaseTables. If your module will support custom fields, also make sure to create a table that ends in _CSTM. If your module will support many-to-many relationships, then you will need to create a relationship module similar to ACCOUNTS_BUGS.
Create the _Update and _Delete procedures using the spSqlBuildProcedures stored procedure.
Create the views using one of the existing modules as a template. You should create 3 views, one is the core view, followed by _List and _Edit.
Create the script to add the module in Data\MODULES defaults.1.sql.
Create the script to add the shortcuts in Data\SHORTCUTS defaults.1.sql.
Create the script to add the list view data. The files are GRIDVIEWS defaults.1.sql and GRIDVIEWS_COLUMNS ListView defaults.1.sql
Create the script to add detail view data. The files are DETAILVIEWS defaults.1.sql and DETAILVIEWS_FIELDS default.1.sql.
Create the script to add edit view data. The fiels are EDITVIEWS defaults.1.sql and EDITVIEWS_FIELDS defaults.1.sql.
Create a new module folder in the web application.
Copy all the files in a similar module to the new folder. Then rename the namespace in each file to match your new module name. Products is a good module to copy as I have just created this module and it has all the core features. I also typically rename all words in the old module to match the new module name.
You will probably need to comment out the procedures to your new module until they are ready. When the procedures are ready, you can navigate to _code\Procedures.aspx to generate the SqlProcs.cs file. The goal is to automatically generate this file so that it is always perfect.

Paul Rony
SplendidCRM Software, Inc.
http://www.splendidcrm.com

From: Ziver MALHASO─×LU [mailto:zam@zam.web.tr] Sent: Saturday, October 06, 2007 5:47 AMTo: Paul RonySubject: Creating a new Module
Hello,

I want to add a new module to the SplendidCRM so what are the steps i need to follow?

I could not find a developer instruction sheet to do such a thing.

May you please help me?

Regards,
Ziver MALHASOGLU