Page 1 of 1
					
				Setting an Alias for object properties
				Posted: Wed Jan 06, 2010 8:22 am
				by Tobias
				When registering a plain C# object as data source, is there a way to provide alias names for the properties?
e.g. having something like:
Code: Select all
public class ReportDataNode
{
    [StiAlias(I18N.Tr("Name"))]
    public string Name {get; set;}
    [StiAlias(I18N.Tr("Quantity"))]
    public string Quantity {get; set;}
}
...as you see, I would like to use aliases to provide translated column/field names, depending on the users locale.
I just stumbled upon an 
old thread, where Edward indicated that such functionality will be available after 2008.2, but I couldn't find a hint, how this was implemented.
Tobias
 
			 
			
					
				Setting an Alias for object properties
				Posted: Fri Jan 08, 2010 4:14 pm
				by Jan
				Hello Tobias,
Please check build from 11 Jan. You can use Stimulsoft.Report.Dictionary.StiAliasAttribute.
Thank you.
			 
			
					
				Setting an Alias for object properties
				Posted: Wed Jan 13, 2010 8:31 am
				by Tobias
				Thanks!
But unfortunately, it only works partially. When having nested objects, the alias is not set for child objects.
See the example below.
On the "detailOnly" dataset everything is fine and DetailProperty gets an alias.
But on the "masterDetail" dataset, the alias of the DetailProperty was not set.
Besides this: In this build the preview tab in the designer is gone, I can only do a html preview.
Code: Select all
public class Master
{
    [StiAlias("MasterProperty Alias")]
    public int MasterProperty { get; set; }
    public IList Details { get; set; }
}
public class Detail
{
    [StiAlias("DetailProperty Alias")]
    public int DetailProperty { get; set; }
}
...
var report = new StiReport();
var detail = new ArrayList {new Detail()};
var masterDetail = new ArrayList()
{
    new Master { Details = new ArrayList { new Detail() } }
};
report.RegData("detailOnly", detail);
report.RegData("masterDetail", masterDetail);
report.Design();
...
 
 
			 
			
					
				Setting an Alias for object properties
				Posted: Thu Jan 14, 2010 8:10 am
				by Edward
				Hi Tobias,
Ok, we will check everything and will let you know our results.
Thank you.
			 
			
					
				Setting an Alias for object properties
				Posted: Sun Jan 24, 2010 5:23 am
				by Jan
				Hello Tobias,
Problem fixed. Please check build from 25 Jan.
Thank you.
			 
			
					
				Setting an Alias for object properties
				Posted: Wed Feb 03, 2010 6:54 am
				by Tobias
				Sorry, couldn't test it before today.
So far the StiAlias attribute seems to work fine.
Thanks a lot!
			 
			
					
				Setting an Alias for object properties
				Posted: Wed Feb 03, 2010 8:18 am
				by Edward
				Hi Tobias,
Please let us know if any help is required.
Thank you.