Re: public abstract static ...

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Thanks,
i will try this template approach, looks nice :)

I've tried NHibernate and Gentle.NET as OPFs so far, both of them have quite
some limitations though, so I'll rather stick with my own "framework" and
code-generation templates...

Thanks!
"Joanna Carter [TeamB]" wrote:

"pali" <pali@xxxxxxxxxxxxxxxxxxxxxxxxx> a écrit dans le message de news:
503F4C34-9142-4247-9D7E-BCFA9D2F22A7@xxxxxxxxxxxxxxxx

| Yes, i know this is the limitation, I'm asking why? Is that a by-design
choice?

I guess so, Delphi has virtual static methods.

| I don't think it's meaningful to instantiate an instance of an object only
| to be able to read/delete it from the store.
| My typical class would look like this:
| public class Customer : EntityBase
| {
| public static Customer GetByID(int id) {}
| public void Save() {}
| public static void Delete(int id) {}
| }
| In this case i don't see a reason to instantiate an object if I want to
get
| it from the database by id anyway. Same for the delete, I don't want to
have
| to get an entity from the database just to be able to delete it.
| I want to put the signatures of those methods in the parent abstract
class,
| so I can get/save/delete them in a generic way...

Then how about factoring out the retrieval behaviour, which I would say
doesn't belong in the Customer class and use an Object Persistence Framework
instead ?

If you are using .NET 2.0, you can have methods on it like :

public class ObjectStore
{
public objectT RetrieveObject<objectT>(int Id)
{
...
}

...
}

Although I would also argue that most times you could retrieve a browsing
list for a criteria and then choose one object. That way you don't need to
know the ID outside of the OPF.

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer



.



Relevant Pages

  • Re: MSNBC article says all cell phone talking and driving is
    ... look at the Caller*ID and see it's your boss or your customer or ... I'll call you right back after I find a safe spot to ... put whatever limitations it wants on said privilege, ...
    (misc.transport.road)
  • Number of records in a dropdown combobox
    ... Where may I find what the limitations are of the various controls, ... number of records/items that can be displayed in a dropdown combobox. ... If, for instance, a customer table has more than the limitation, I'm ...
    (microsoft.public.dotnet.languages.csharp)
  • SPS 2003 as a external customer portal
    ... What are the limitations of using sharepoint portal 2003 ... customer hasn't got Office 2003 or ie6 then it isn't a ... viable solution. ...
    (microsoft.public.sharepoint.portalserver.development)
  • Re: XP Requirement Analysis?
    ... > The developers will implement the stories as requested by the customer - ... > The customer will know the limitations of the system, ... > agreed the stories in the first place. ... a complicated task breakdown. ...
    (comp.object)