views:

81

answers:

1

I would like to generate an auto-property. At the moment I can add a property to the CodeClass by using the following:

 codeproperty = entityClass.AddProperty(columnName, columnName,  c.ColumnType);

but this produces code like this:

        int AddressID
    {
        get
        {
            return default(int);
        }
        set
        {
        }
    }

..and I want it to look like this:

        int AddressID {get; set;}
+1  A: 

It looks like you probably can't do this using the code model. Information regarding whether a property is auto-implemented is exposed via an extender(ICSAutoImplementedPropertyExtender), but its IsAutoImplemented property is read-only.

That said, given that you know that the code language is C#, why not simply insert the literal code that you want to generate?

Nicole Calinoiu
That is a good idea, I will do as you say in insert it myself. Thanks
Phill Duffy