MarimerLLC / cslaforum

Discussion forum for CSLA .NET
https://cslanet.com
Other
31 stars 6 forks source link

New DP_XYZ method name defaults #799

Open rockfordlhotka opened 5 years ago

rockfordlhotka commented 5 years ago

I am looking for input.

In the new CSLA v5 model the server-side data portal methods can have any valid name. I'm wondering what should be the new default naming convention?

They were DataPortal_XYZ - DataPortal_Fetch, etc.

Right now the snippets continue to use that convention, but with the new attributes, so

  [Fetch]
  private void DataPortal_Fetch(int id)

The problem with this is that some of those methods are virtual from the base classes. For example:

  [Update]
  protected override void DataPortal_Update()

As a default this isn't ideal, because as soon as anyone starts adding injected parameters then the override won't match the base and compiler errors will result. In other words, it is kind of a pain.

So I'm thinking other naming would be better - avoid the overrides by default. Options that come to mind:

  1. Simple names: Create, Fetch, Update, Insert, Delete, DeleteSelf
  2. Different prefix: Csla_XYZ or DP_XYZ

The drawback to the simple names is that they might conflict with existing names or methods people want for their own use. The upside is that they are simple and straightforward.

The different prefix is ok, but not as readable as the simple names. But they would probably avoid any possible conflicts with methods people would otherwise want to implement themselves.

I appreciate any feedback or thoughts.

JasonBock commented 5 years ago

My reactionary $0.02....

I don't like method names with underscores. They look like the auto-generated event name that I know VB does (or did) and …. bleh. So please don't do that!

What I'm missing is, why does there have to be a "default" name anyway? Why worry about a convention? That's completely up to the developer now.

rockfordlhotka commented 5 years ago

The snippets need something in them :)

JasonBock commented 5 years ago

Snippets, schnippets :)

I'd go with names that match the attribute names. The developer can choose to rename them if they want.

jensbrand commented 5 years ago

I strongly agree with Jason, you should avoid method names with underscores.

itgoran commented 5 years ago

I'd go with names that match the attribute names. The developer can choose to rename them if they want.

Yes,

thaehn commented 5 years ago

I agree that the names should match the attribute name.

rockfordlhotka commented 5 years ago

I'm sensing a clear preference here 😄