MarimerLLC / csla

A home for your business logic in any .NET application.
https://cslanet.com
MIT License
1.24k stars 395 forks source link

Eliminate hardcoded DataPortal_XYZ method names #1102

Closed rockfordlhotka closed 4 years ago

rockfordlhotka commented 5 years ago

Today the DataPortal_XYZ and Child_XYZ method names are hardcoded into the data portal. They should not be hardcoded.

In short, people should be able to come up with their own naming convention for these methods, and the data portal should invoke the appropriate methods.

UPDATE: This comment has a detailed list of the options being considered.

JasonBock commented 5 years ago

Are we assuming only one object can come in as a criteria? Is there any reason why we can't do this:

[Fetch]
public async Task MyFetchAsync(int id, string name) { ... }

Or are we always forced to have one, and only one, object? But that can be overloaded?

I guess what I don't understand is that C# is able to disambiguate between valid overloads. So, why can't CSLA? Or is this because the call is remote and you have that params support thingee? :)

SergeyBarskiy commented 5 years ago

@JasonBock I believe DataPortal.Fetch has only support for a single criteria object for the root fetch. Child fetch supports unlimited parameters via params object[]. This will be harder if you want to support also method dependency injection, kind of forced by the concept of data portal. But I do agree, I also do not see a reason for paramterized fetch, but maybe it would be good to have Fetch and ChildFetch attributes ?

rockfordlhotka commented 5 years ago

@SergeyBarskiy you are right - we will need ChildFetch or FetchChild attributes as well.

I sort of lean toward CreateChild and FetchChild naming because I think that'll make intellisense more useful, but am open to arguments for putting Child first.

rockfordlhotka commented 5 years ago

I wrote up the algorithms for criteria-provided an no criteria for method resolution in https://github.com/MarimerLLC/csla/issues/787#issuecomment-498075922. I'd appreciate your thoughts on the algorithm to see if I got it right (@SergeyBarskiy @JasonBock @dazinator and anyone else).

github-actions[bot] commented 1 year ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.