Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using the Generic Factory
Message
De
02/05/2007 11:56:12
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01221251
Message ID:
01221851
Vues:
20
Hi Kevin,

>>I need to factory drive classes instantiation in my application. There is a application factory, but since it is derived from an abstract class, I can only use it for overriding methods from MM. I also see the documentation talks about a generic factory. The documentation shows how to set up the classes table for it, but that is where it stops.
>
>You can simply extend the existing Factory.cs/Factory.vb file for your application-specific needs--you don't need to create a new factory.
>
>>Has anybody been using the generic factory?
>
>The Generic factory is specifically suited for data-driving class instantiation. If you don't need this feature then I don't recommend using it.
>

Then this should be correct?
in App.cs I create a reference to the factory so it is created
Factory factory = mmAppBase.Factory;

Then add a CreateRfid in the application level factory class
public RfidReaderBase CreateRfidReader()
{
return new RfidReaderIntermec();
}

I add a property to the app.cs file
public RfidReaderBase Rfid
{
get
{
if (rfid == null)
{
rfid = factory.CreateRfidReader();
rfid.Initialize();
}
return rfid;
}
}
private RfidReaderBase rfid;
Timothy Bryan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform