WCF Data Contract - Business Entity Generation

Aug 28, 2007 at 2:13 PM
Edited Aug 28, 2007 at 2:18 PM
Hi,

Are there any plans to support ORCAS and WCF Data Contracts when generating Business Entities?

I modified the BusinessEntity.T4 file to generate the desire attributes:


Regards,
Nou

================
<#
foreach(Entity entity in Entities)
{#>
// begin "<#= entity.Name #>.cs"
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;

namespace <#= this.BusinessEntityClassNamespace #>
{

DataContract
public partial class <#= entity.Name #>
{
public <#= entity.Name #>()
{
}

public <#= entity.Name #>(<#= GetConstructor(entity) #>)
{
<# foreach(Property property in entity.Properties)
{
#>
this.<#= GetFieldName(property.Name) #> = <#= GetVariableName(property.Name, true) #>;
<#
}
#>
}

<# foreach(Property property in entity.Properties)
{
#>
private <#= (property.IsNullable && property.Type.IsValueType) ? "Nullable<" + property.Type.ToString() + ">" : property.Type.ToString() #> <#= GetFieldName(property.Name) #>;

DataMember
public <#= (property.IsNullable && property.Type.IsValueType) ? "Nullable<" + property.Type.ToString() + ">" : property.Type.ToString() #> <#= property.Name #>
{
get { return this.<#= GetFieldName(property.Name) #>; }
<#
if(!property.ReadOnly)
{
#>
set { this.<#= GetFieldName(property.Name) #> = value; }
<#
}
#>
}
Developer
Sep 25, 2007 at 8:53 AM
I vote dont do this , i serialized my business projects in my first service project 4 years ago but regret it now last 2 have been much better.

The BEST thing about the Serviice factory is it seperates the message layer from the business objects and encourages chunky messages and encourages this best practice.

If it is is allowed it should be hidden with warnings.


Regards,

Ben