Home > .NET Domain Model, Developing Using CodeFluent Entities > Generating Methods in the Collection Class

Generating Methods in the Collection Class


By default, methods working on an entity (e.g. Loadone, Delete, …) are generated in the entity class and methods working on a set of entities (e.g. Load, Search, …) are generated in the collection class. But what about custom business methods? What if I want to implement a custom business method in the business tier?

By default those are placed in the generated entity class but you can control this behavior via the methodType attribute on the method element.

Example:

<Customer>
        <Id typeName="guid"/>
        <FirstName typeName="string" />
        <LastName typeName="string" />
        <SpecialNumber typeName="string" />
        <cf:method name="LoadCorrectCustomers" methodType="SetBodySnippet"
                                 memberAttributes="public, static" returnTypeName="CustomerCollection">
            return InternalLoadCorrectCustomers();
        </cf:method>
<Customer>

More information about methods is available in the documentation.

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s