Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
XSD & generated dataset - Base class
Message
 
À
22/11/2004 13:33:40
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Divers
Thread ID:
00963350
Message ID:
00963618
Vues:
7
Thanks Bonnie,

I'll try do do the same but i'll use C# not VFP, I need some practice... Anyway is it me or VS.NET is an unfinish product ?

>Stephane,
>
>No, C# does not support multiple inheritance. I guess you're out of luck. =(
>
>We wrote ourselves a little VFP utility a coupla years ago(simply because VFP is good with string manipulation) ... when we generate a Typed DataSet, we go to the generated code and copy it to the clipboard. Then, the VFP utility takes stuff from the clipboard and generates what amounts to all the copy/paste stuff you'd have to do for a new sub-class of that Typed DataSet and puts *that* on the clipboard. Simply paste it all into your new sub-class.
>
>~~Bonnie
>
>
>
>>Thanks Again Bonnie for your reply, your solution make sense but i would have to cut and paste the method FillWithXML to all the derived classes where if the generated DS would already derive from my base class, i would not have to code anything other then the very specifics of that class.
>>
>>Is there any way to have multiple inheritance in C# ? like this:
>>
>>
>>public class Ar_CustMaster_DataSet : MyNameSpace.MyDataSet, IMyDataSet
>>
>>
>>
>>
>>>Stephane,
>>>
>>>Put public methods/properties in your base DataClass that you call from your sub-classed DataSets. Something like this:
>>>
>>>	public interface IDataSet
>>>	{
>>>		void FillWithXml(string XML);
>>>	}
>>>
>>>	public class XmlConverter
>>>	{
>>>		public void ImportXml(DataSet Data, string XML)
>>>		{
>>>			StringReader sr = new StringReader(XML);
>>>			Data.ReadXml(sr, XmlReadMode.InferSchema);
>>>			Data.AcceptChanges();
>>>		}
>>>	}
>>>
>>>Then in your sub-classed DataSets:
>>>
>>>public class Ar_CustMaster_DataSet : Ar_CustMaster, IMyDataSet
>>>{
>>>  private MyBaseDataClass.XmlConverter Converter = new MyBaseDataClass.XmlConverter();
>>>
>>>  public void FillWithXML(string XML)
>>>  {
>>>    this.Converter.ImportXML(this, XML);
>>>  }
>>>}
>>>
>>>
>>>~~Bonnie
>>>
>>>
>>>
>>>
>>>>Thanks Bonnie,
>>>>
>>>>That's what i did but the problem with interface is i have to cut & paste the implementaion code to all my derived dataSets since the code is the same for all. It would be much easier to simple derive from a base class containing all the common code. Looks like nothing is easy in .NET!!
>>>>
>>>>
>>>>>Stephane,
>>>>>
>>>>>You don't want to mess with the generated code. I recommend using an Interface and then create a sub-class from your typed DataSet. Something like this:
>>>>>
>>>>>public interface IMyDataSet
>>>>>{
>>>>>  void MyDataSetMethod();
>>>>>}
>>>>>public class Ar_CustMaster_DataSet : Ar_CustMaster, IMyDataSet
>>>>>{
>>>>>  public void MyDataSetMethod()
>>>>>  {
>>>>>    // whatever code
>>>>>  }
>>>>>}
>>>>>
>>>>>
>>>>>~~Bonnie
>>>>>
>>>>>
>>>>>>I am trying to figure out how i can make the generated typed datasets from VS 2003 us my dataSet base class instead of the Syste,.Data.DataSet base class.
>>>>>>
>>>>>>The genarated code produce this:
>>>>>>
>>>>>>    public class AR_CustMaster : DataSet {}
>>>>>>
>>>>>>
>>>>>>I need the dataset generator to produce this:
>>>>>>
>>>>>>    public class AR_CustMaster : MyDataSet {}
>>>>>>
>>>>>>
>>>>>>I know i can go in the generated .cs file and manually change it but as soon as the dataset is regenerated, my changes are lost.
>>>>>>
>>>>>>Is there any way to make the change permanent ?
>>>>>>
>>>>>>Thanks.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform