Page 1 of 1

missing: constructor visibility modifier

Posted: Tue 03 Jan 2012 21:57
by mindplay
I can control the modifier of a Class, but it appears there is no way to control the modifier on the auto-implemented constructor?

I have many cases where the type itself is public or internal, but access to the auto-generated zero-argument constructor needs to be restricted.

There are many common cases where constructing a valid instance of a given type is impossible without a particular argument; for example, cases where some type of child-object is not valid without specifying the owner-object.

Taking a literal example, let's say we have types Door and House. We don't want Doors in our model (or database) that don't reference the House they're attached to - in this case, the generated zero-argument public constructor poses a problem, since it enables you to construct instances of Door that violate this constraint; the constructor must be made private, and I must implement a public Door constructor that requires a House argument.

I could certainly add this feature myself, but it seems like it's going to be a common requirements. Any chance you plan on adding that feature?

Posted: Wed 04 Jan 2012 15:25
by Helen
Thank you for your suggestions. They help us to improve our product.

We will implement this feature. We will post here when the corresponding build of Entity Developer is available for download.

Posted: Thu 12 Jan 2012 15:20
by Helen
The new 'ConstructorModifier' extended property, which allows controlling access for the class constructor, is added for entities and complex types.

This feature is available in the latest 4.2.110 build of Entity Developer.
It can be downloaded from http://www.devart.com/entitydeveloper/download.html (trial version) or from Registered Users' Area (for users with valid subscription only).
For more information, please refer to http://www.devart.com/forums/viewtopic.php?t=23135 .