Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Monday, August 18, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Web Forums - SalesLogix Web Platform & Application Architect
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Web Platform & Application Architect | New ThreadView:  Search:  
 Author  Thread: New to SLX Web Platform. Need to write C# library to expose data from DB, confused about entities, nhibernate, etc. Need your help!
NixDev
Posts: 98
 
New to SLX Web Platform. Need to write C# library to expose data from DB, confused about entities, nhibernate, etc. Need your help!Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Apr 09 8:35 PM
This is my first post, so hi to all.

I've been asked to write a C# library that will expose data from custom DB views. I've been reading the whole day about the new Application Architect, Entities, the use of NHibernate, etc, but I'm still not very sure about how I should be doing this.

For instance, lets say I have an Account_Activity_Summary view, and I have to expose a method that queries this view for a given accountid in a given period. The data retrieved will be displayed in Web Client somehow (I haven't got to that part yet). I will be writing this in Visual Studio using C#.

- What assemblies should I reference?
- Can I return just a DataSet or DataTable to be used within SalesLogix Web, or do I have to return a list of entities or something else?
- Should I be using NHibernate to query the DB, or can I just use straight ADO.NET?
- Should I receive a IAccount object parameter or just an AccountId string?
- Do I have to create an entity for this account activity summary in Application Architect?
- If so, how will I be able to "see" the definition of this entity in Visual Studio? What do I need to include?

I have been the whole day long reading and trying to find an example that covers something like this from top to bottom, but I haven't found anything.

I know I'm asking a lot of questions at the same time, any help and ideas will be more than appreciated.

Thanks
[Reply][Quote]
Ray Walther
Posts: 8
 
Re: New to SLX Web Platform. Need to write C# library to expose data from DB, confused about entities, nhibernate, etc. Need your help!Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Apr 09 7:36 AM
Ok you have asked a lot of questions in one post and probably more than can be realistically answered in this forum. I recommend one of two things. Take the developer course from Sage (not cheap) or get the latest DevLogix book from Stephen Redmond (http://www.cafepress.com/DevLogixShop) its not cheap but it is very well done and gives you basically a step by step approach to how to use the Web Development environment and will answer the majority of your questions above. If you are wanting to extract data from SQL Views (not sure what if thats what you mean by custom DB views) it is a little tricky as Sage does not handle this very easily. I was forced to created extended properties to the entity model using C# code snippet to access each column in my SQL views via ADO.Net. Not ideal but it works.

Good luck.....

Ray
[Reply][Quote]
NixDev
Posts: 98
 
Re: New to SLX Web Platform. Need to write C# library to expose data from DB, confused about entities, nhibernate, etc. Need your help!Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Apr 09 10:12 AM
Thanks for replying. I know I've asked a lot of questions; my apologies if this is too much to ask at the same time, it's just that my mind is a mess at this point, as I have a tight deadline, and I don't know where to start really.

Yes, I want to extract Data from SQL Views. I thought I could make them appear as standard SLX Tables by "registering" those through SLX DB administrator? I know I've done that before using the Win client, is the Web client different regarding this?

I appreciate your suggestions regarding the book and taking a course, I'll be checking out those, but it's my feeling that my employer won't want to spend on them.
[Reply][Quote]
NixDev
Posts: 98
 
Re: New to SLX Web Platform. Need to write C# library to expose data from DB, confused about entities, nhibernate, etc. Need your help!Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Apr 09 10:18 AM
Regarding the other questions, any ideas will help, even if they do not cover all the questions.

Thanks.
[Reply][Quote]
Ray Walther
Posts: 8
 
Re: New to SLX Web Platform. Need to write C# library to expose data from DB, confused about entities, nhibernate, etc. Need your help!Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Apr 09 11:19 AM
The book is under $200 and is a smart investment. The SQL Views in theory should be able to read in as an Entity but does not work. I was forced to extend the base tables using the C# code snippets. Hopefully the following example will help:


#region Usings
using System;
using Sage.Entity.Interfaces;
using Sage.Form.Interfaces;
using System.Data;
#endregion Usings

namespace Sage.BusinessRules.CodeSnippets
{
public static partial class TLXProjectBusinessRules
{
public static void GetProfitStep( ITLXProject tlxproject, out System.Double result)

{
//Get Service so we can use the connection object
Sage.Platform.Data.IDataService service = Sage.Platform.Application.ApplicationContext.Current.Services.Get();
//Read Data
using (IDbConnection conn = service.GetConnection())
{
conn.Open();
using (IDbCommand command = conn.CreateCommand())
{
command.CommandText = string.Format("Select Profit from TLXv_ProjectSummary where Timelink_ProjectsID = '{0}'", tlxproject.Id.ToString());
result = (double)command.ExecuteScalar();
}

}
}
}
}
[Reply][Quote]
Nick Hollis
Posts: 549
Top 10 forum poster: 549 posts
 
Re: New to SLX Web Platform. Need to write C# library to expose data from DB, confused about entities, nhibernate, etc. Need your help!Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Apr 09 6:00 AM
- What assemblies should I reference?

If you want to return Ilist of entities, then include a reference to the Sage.Saleslogix.Entities.dll and Sage.Entity.Interfaces.dll (from your deployment path);

If you want to use HQL then you will need to include a lot more, such as NHibernate, NVelocity, Sage.Platform,Linqbridge.....Im getting bored now! This is not an exhaustive either. As I mentioned in a previous post, you would be much better of using business rules as you wouldnt need to worry about all of these references....

- Can I return just a DataSet or DataTable to be used within SalesLogix Web, or do I have to return a list of entities or something else?

IList of entities preferably.

- Should I be using NHibernate to query the DB, or can I just use straight ADO.NET?

Whatever is easiest. I would use ADO.NET as otherwise you will have to find out which nhibernate dlls/registries to add.

- Should I receive a IAccount object parameter or just an AccountId string?

Optional - if you are using sql/hql there is no point passing the account entity, just use the AccountId string.

- Do I have to create an entity for this account activity summary in Application Architect?

No (you wont be able to anyway if this is a view).

- If so, how will I be able to "see" the definition of this entity in Visual Studio? What do I need to include?

The dll's mentioned above (Sage.Saleslogix.Entities/Sage.Entity.Interfaces) will give you access to all of the Interfaces currently in your SLX build.
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: New to SLX Web Platform. Need to write C# library to expose data from DB, confused about entities, nhibernate, etc. Need your help!Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Apr 09 11:15 AM
In addition to the two that Nick mentioned (Sage.Saleslogix.Entities.dll & Sage.Entity.Interfaces.dll) you'll also want to reference Sage.Platform.dll.

As far as returning DataSets vs Entities, really doesn't matter too much. After all, everything is just ASP.NET so you can bind a DataSet just the same as you can an IList. Just depends more on how you plan to use the rule.

As Ray mentioned earlier in the thread, you can also use the DataService to get a connection or connection string to the local database, if that is where your views are. Otherwise, you'll just use a connection string to get to the other server/database to get the data as usual.
[Reply][Quote]
NixDev
Posts: 98
 
Re: New to SLX Web Platform. Need to write C# library to expose data from DB, confused about entities, nhibernate, etc. Need your help!Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Apr 09 9:15 PM
Thanks to all for your kind replies. For testing purposes, I did what Ray suggested. Now, I'm having a problem:

The type or namespace name 'Data' does not exist in the namespace 'System' (are you missing an assembly reference?)

I went to the properties window, chose Sage.Platform.Orm.Entities.CodeSnippetHeader, clicked assembly references collection to add System.Data, but I don't know what value should "Hint Path" have. If I leave it empty I get the following error:

TITLE:
------------------------------

An application exception has occurred.

------------------------------
ADDITIONAL INFORMATION:

Could not load file or assembly 'C:\Program Files\SalesLogix\System.Data' or one of its dependencies. The system cannot find the file specified. (mscorlib)

What value should I set this to?

Thanks!
[Reply][Quote]
Nick Hollis
Posts: 549
Top 10 forum poster: 549 posts
 
Re: New to SLX Web Platform. Need to write C# library to expose data from DB, confused about entities, nhibernate, etc. Need your help!Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 Apr 09 3:10 AM
Hi,

The System.Data.dll is in the .NET folder, so something like C:\Windows\Microsoft.NET\Framework\v2.0.50727, the reference should be added to the CodeSnippet XML document which is held in:

C:\Documents and Settings\All Users\Application Data\Sage\Platform\Configuration\Global

The file being called:

codesnippets.xml

Add a line to reference the System.Data.dll at the top (along with the other references), so a line like:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll

Inside the node.

Close App Architect, log back in and try a build again.

Thanks,
Nick
[Reply][Quote]
NixDev
Posts: 98
 
Re: New to SLX Web Platform. Need to write C# library to expose data from DB, confused about entities, nhibernate, etc. Need your help!Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 Apr 09 10:45 AM
Thanks Nick! As usual, your help is invaluable! I'm not at my work computer at the moment, as soon as I'm there I'll give this a try...
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 8/18/2025 5:24:43 AM