Actually I am looking for the best design for this so that Engine could be
extended for different export also say export to excel.
What I am doing is...
For each response, I have created POCO class which is decorated with
Attribute Class.
By Applying Strategy Pattern, I am deciding whether to go for Export to CSV
aur Export to Excel. I am passing POCO class as a list object on it so that
data could be streamed as per Engine requirement.
Now I think adding attributes on POCO class will not be a good idea. So I
am looking for something like mapping of properties like Fluent NHibernate.
Like
public class MyClassMapping : ClassMap<MyClass>
{
public ReportConditionMapping()
{
Map(m => m.Abc, "ABC");
Map(m => m.Xyz, "XYZ");
}
}
With attributes I did something like this
public class Student
{
//Mapping
[CsvColumnName(Name = "Full Name", Order = 1)]
public string Name { get; set; }
[CsvColumnName(Name = "Age", Order = 2)]
public int Age { get; set; }
}
Is it possible to have mapping like FluentNhibernate style??
On Thu, Jan 10, 2013 at 1:35 AM, Stephen Russell <[email protected]>wrote:
>
>
> On Wed, Jan 9, 2013 at 12:31 PM, Aman Sharma <[email protected]>wrote:
>
>> Data would be in the form of Entity object. I will create POCO class with
>> required properties. Will send this class object into Export to csv class.
>>
>> --------------------------
>
> Is POCO a List<> without entities or List<> inside?
>
> Guessing that it is a List<> which makes it harder vs. having a DataTable
> that can be passed in as a generic type. Entity objects are tightly typed.
>
> public String POCOcsv( List<Poco> POCO)
> {
> StringBuilder sb = new StringBuilder();
>
> foreach( Poco p in POCO)
> { // at the row level
> // must hard code the entity
> sb.Append(p.Name+', ')
> sb.Append(p.Comapny+', ')
> sb.Append(p.Region+', ')
> sb.Append(p.Language+', ')
> sb.Append(p.Status+ CRLF())
> }
>
> return sb.ToString();
>
> }
>
>
>
>
>
>
> --
> Stephen Russell
> Sr. Analyst
> Ring Container Technology
> Oakland TN
>
> 901.246-0159 cell
>
> --
> You received this message because you are subscribed to the Google
> Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
> Web Services,.NET Remoting" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
> or visit the group website at http://megasolutions.net
>
--
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net