2/21/2025 6:01:02 AM
|
|
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!
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.
|
|
|
|
Error while building a custom property to account entity
Posted: 29 Feb 08 7:07 AM
|
Hi, I am trying to create Account level property which would return me collection of accounts(SLX ver 7.2.1). I am somewhat confused with the joints hence opted for this path. Here is what I had done for a custom property ======================================================================= public virtual System.Collections.Generic.ICollection AgencyClients { get { Sage.Platform.Data.IDataService connService = Sage.Platform.Application.ApplicationContext.Current.Services.Get(); String connection = connService.GetConnectionString(); System.Data.SqlClient.SqlDataReader reader; System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(connection); conn.Open(); System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand(); string vsql = "Select AccountId from C_ACCOUNT_EXTENSION where CLIENTAGENCYID='" + this.Id +"'"; command.CommandText = vsql; command.Connection = conn; reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { IAccount account = EntityFactory.GetById(reader[0]); AgencyClients.Add(account); } } return AgencyClients; } } ========================================================================== I am getting an error on the line where I am trying to access dataservice. Error I am getting while building a platform is as follows
ERROR - c:\Documents and Settings\Administrator\Application Data\Sage\Platform\Output\implementation\Account.cs(449,70):The type or namespace name 'Application' does not exist in the namespace 'Sage.Platform' (are you missing an assembly reference?)
Any help would be greatly appreciated. Is there any other alternative to achieve this?
Thanks and Regards, Sandeep Gaykhe
|
|
|
|
Re: Error while building a custom property to account entity
Posted: 29 Feb 08 3:56 PM
|
Could it be that the following line is no longer in your codesnippets.xml file?
<reference>%BASEBUILDPATH%\assemblies\Sage.Platform.Application.dll</reference> Also, you're trying to assign the values to the property, instead create a local IList collection and assign the accounts to that then return it. Beware, you're not disposing of your disposable objects. Also note, "Id" is an object, not a string, so you'll need to call ToString() on it to append You could do that as well without the need to make the connection, something like this:
using (SessionScopeWrapper wrapper = new SessionScopeWrapper()) { IQueryable repository = (IQueryable) EntityFactory.GetRepository<IAccount>(); IExpressionFactory expressionFactory = repository.GetExpressionFactory(); ICriteria criteria = repository.CreateCriteria(); // guessing the extension entity name and property here // also, not sure if you can reference the related extension entity // property in the query like this, but i'll leave that for you to try criteria.Add(expressionFactory.Eq("AccountExtension.ClientAgencyID", this.Id.ToString())); return criteria.List<IAccount>(); } Something like that.
-Ryan
|
|
|
|
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!
|
|
|
|
|
|
|
|