BITtelligent Software Logo
  • Home
  • Products
    • Infor CRM
    • Salesfusion
    • Codeless
    • Dynalink
    • ERP Link
  • Services
  • Clients
  • Blog
  • Careers
  • Team
  • About
  • Sign In

There’s a Service for That

May 19. 2010 0 Comments   Posted in:  SalesLogix SalesLogix Web
A question came up yesterday with regards to how to create SalesLogix ids within the Web Framework. In the legacy client and our external development we would generally call a provider Stored procedure that would give us the Id. The code might look as the following
List<string> list = new List<string>();

using (
       var cmd = new OleDbCommand(string.Format("slx_dbids('{0}', {1})", table, count), 
       connection)
)
{

   var r = cmd.ExecuteReader();

   while (r.Read())
   {
      list.Add(r.GetString(0));
   }

    r.Close();
 }

return list;

Now within the SalesLogix web client infrastructure it is a actually easier if you know where to look.

The framework exposes a service – SalesLogixEntityKeyGenerator. You can get access to this service using the following code;

SalesLogixEntityKeyGenerator generator = 
ApplicationContext.Current.Services.Get<SalesLogixEntityKeyGenerator>(false);

 

Once you have access to the generator it its very easy to get a set of keys;

List<string> keys = new List<string>(generator.GenerateIds(typeof(IHistory), 1));

 

There you have it.

BITtelligent Software and Media, Inc.
Tel: (519) 620-7153
support@bittelligentdev.com
sales@bittelligentdev.com
380 Jamieson Parkway, Unit 5
Cambridge, Ont N3C 4N4