Ejemplo n.º 1
0
        public void ChangeTypeAndFormat(SampleType newType, string newFormat, string newFormatParameters)
        {
            newFormat           = SampleDataFormatHelper.NormalizeFormat(this.PropertySampleType as SampleBasicType, newFormat, true);
            newFormatParameters = SampleDataFormatHelper.NormalizeFormatParameters(this.PropertySampleType as SampleBasicType, newFormatParameters, true);
            if (this.PropertySampleType == newType && this.Format == newFormat && this.FormatParameters == newFormatParameters)
            {
                return;
            }
            if (this.PropertySampleType != newType)
            {
                this.DeclaringDataSet.ThrowIfRecursiveRootType(newType);
            }
            SampleType propertySampleType = this.PropertySampleType;
            string     format             = this.Format;
            string     formatParameters   = this.FormatParameters;

            this.PropertySampleType = newType;
            this.Format             = newFormat;
            this.FormatParameters   = newFormatParameters;
            this.DeclaringDataSet.OnPropertyTypeOrFormatChanged(this, propertySampleType, format, formatParameters);
        }
Ejemplo n.º 2
0
        public SampleProperty AddProperty(string name, SampleType sampleType)
        {
            if (sampleType == this.DeclaringDataSet.RootType)
            {
                throw new InvalidOperationException(string.Format((IFormatProvider)CultureInfo.InvariantCulture, ExceptionStringTable.RecursiveSampleDataRootTypeNotSupported, new object[1]
                {
                    (object)this.DeclaringDataSet.RootType.Name
                }));
            }
            if (this.GetSampleProperty(name) != null)
            {
                throw new InvalidOperationException(string.Format((IFormatProvider)CultureInfo.InvariantCulture, ExceptionStringTable.NameIsAlreadyInUse, new object[1]
                {
                    (object)name
                }));
            }
            SampleProperty sampleProperty = new SampleProperty(name, sampleType, this);

            this.sampleProperties.Add(sampleProperty);
            this.DeclaringDataSet.OnPropertyAdded(sampleProperty);
            return(sampleProperty);
        }
Ejemplo n.º 3
0
 public bool PushCollectionItemType(SampleType itemType)
 {
     return(this.Push(itemType, string.Empty));
 }
Ejemplo n.º 4
0
 public BuildingItem(SampleType type, string identity)
 {
     this.Type     = type;
     this.Identity = identity;
 }
Ejemplo n.º 5
0
 public DocumentNode CreateNode(SampleType sampleType)
 {
     return(!sampleType.IsBasicType ? (DocumentNode)this.CreateCompositeNode((SampleNonBasicType)sampleType) : (DocumentNode)this.CreateBasicNode((SampleBasicType)sampleType, (string)null));
 }
Ejemplo n.º 6
0
 public DocumentNode GenerateValue(SampleType sampleType)
 {
     return(!sampleType.IsBasicType ? this.GenerateNonBasicValue((SampleNonBasicType)sampleType) : this.GenerateBasicValue((SampleBasicType)sampleType, (string)null, (string)null));
 }
Ejemplo n.º 7
0
            public string GetPropertyDefaultValue(SampleProperty sampleProperty)
            {
                SampleType propertySampleType = sampleProperty.PropertySampleType;

                return(!propertySampleType.IsBasicType ? this.NewInstanceFieldValue.Replace(SampleCodeGenerator.PropertyTypeTemplate, propertySampleType.Name) : this.BasicTypeValues[(SampleBasicType)propertySampleType]);
            }
Ejemplo n.º 8
0
        public IType CreateCollectionType(string name, IType itemType)
        {
            SampleType itemType1 = this.FromType(itemType);

            return((IType)this.dataSet.CreateCollectionType(name, itemType1));
        }