using resereved words "System" as Property Name

Jun 11, 2010 at 9:33 AM

1.  Guys, I had error when i called  attribute by "System". -  in de/serialize method. Compiler trying to set SeekOrigin, but it`l find only ClassName.System .IO  :) 

-- memoryStream.Seek(0, System.IO.SeekOrigin.Begin);

 

What for we set this namespace directly inside the methods, maybe should use it only one time in the using directives? - there is no any mistakes :) 

2.  And also i want to pay your attention next moment - collection attribute Name:  

 - in sheme:    i called collection "pens"  for example    

-  in xml:   each item in "pens" collection has the same name as in the sheme name - "pens" / so i think we should change name in the sheme to "pen"

-  in the class :  if  collection attribute has simply item name - "pen" - >  the same name will be in the class !!!! but it  isn`t  logically clear name for class collection property - it should be "pens"

-->So i want to offer you to change only property name in the class, if it s collection property of course to 's' at the end of the word or to 'ies' if word eding on 'y'.          ????

It's simply such changed in the CodeExtension.ProcessProperty() method

 if (prop.Type.ArrayElementType != null)
            {

                // not bold code is my offer

                if (prop.Name.EndsWith("y"))
                {
                    prop.Name = prop.Name.Remove(prop.Name.Length - 1);
                    prop.Name += "ies";
                }
                else
                { prop.Name += "s"; }

                prop.Type = this.GetCollectionType(prop.Type);
                collectionTypesFields.Add(prop.Name);
            }