Re: public abstract static ...



"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

  • Spreadsheet/VBA Project Consulting: 50% Discount or Even Free - Limited Time Only
    ... UDQ Consulting Services Believes that Every Problem Should Have an Easy & ... templates, spreadsheet applications, and database applications. ... P001: Mortgage Transaction Spreadsheet Database ... Customer List Converted from Excel Table to Word ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Spreadsheet/VBA Project Consulting: 50% Discount or Even Free - Limited Time Only
    ... > UDQ Services has years of experience with MS Excel and VBA (Visual Basic ... > templates, spreadsheet applications, and database applications. ... > P001: Mortgage Transaction Spreadsheet Database ... Customer List Converted from Excel Table to Word ...
    (microsoft.public.excel.worksheet.functions)
  • Spreadsheet/VBA Project Consulting: 50% Discount or Even Free - Limited Time Only
    ... UDQ Consulting Services Believes that Every Problem Should Have an Easy & ... templates, spreadsheet applications, and database applications. ... P001: Mortgage Transaction Spreadsheet Database ... Customer List Converted from Excel Table to Word ...
    (microsoft.public.excel.programming)
  • Spreadsheet/VBA Consulting - 50% Off or Even Free
    ... UDQ Consulting Services Believes that Every Problem Should Have an Easy & ... templates, spreadsheet applications, and database applications. ... P001: Mortgage Transaction Spreadsheet Database ... Customer List Converted from Excel Table to Word ...
    (microsoft.public.excel.misc)
  • Spreadsheet/VBA Consulting - 50% Off or Even Free
    ... UDQ Consulting Services Believes that Every Problem Should Have an Easy & ... templates, spreadsheet applications, and database applications. ... P001: Mortgage Transaction Spreadsheet Database ... Customer List Converted from Excel Table to Word ...
    (microsoft.public.excel.newusers)