Пример #1
0
 /// <summary>
 /// constructor
 /// </summary
 public LanguageTextType(SymbolType cultural, string name = null,Boolean isNullable=false, Engine engine = null)
     : base(typeId: otDataType.LanguageText, isNullable: isNullable, defaultvalue: null, engine: engine, name: name)
 {
     this.ComplexTypeName = ConstTypeName;
     AddMember(ConstText, PrimitiveType.GetPrimitiveType(otDataType.Text));
     AddMember(ConstCultural, cultural);
     _signature = CreateSignature(_structure.Values, isNullable: isNullable, typename: ConstTypeName, name: name);
     // raise event
     RaiseOnCreation(this, datatype: this, engine: engine);
 }
Пример #2
0
        /// <summary>
        /// returns or creates an anonymous type from the engine
        /// </summary>
        public static LanguageTextType GetDataType(SymbolType cultural, Engine engine, string name = null, bool isNullable = false)
        {
            string sig = CreateSignature(structure: new IDataType[] { PrimitiveType.GetPrimitiveType(otDataType.Text), cultural }, isNullable: isNullable);
            if (!String.IsNullOrEmpty(name) && engine.Repository.HasDataType(name))
            {
                IDataType aDatatype = engine.Repository.GetDatatype(name);
                if (aDatatype.TypeId == otDataType.LanguageText) return (LanguageTextType) aDatatype;
                throw new RulezException(RulezException.Types.IdExists, arguments: new object[] { name, aDatatype.Name  });
            }

            if (engine.Repository.HasDataTypeSignature(sig)) return (LanguageTextType)engine.Repository.GetDatatypeBySignature(sig).FirstOrDefault();
            // create new one
            return new LanguageTextType(cultural: cultural, isNullable: isNullable, name:name, engine: engine);
        }
Пример #3
0
 /// <summary>
 /// constructor
 /// </summary
 public DecimalUnitType(SymbolType unit, string name = null, Boolean isNullable= false, Engine engine = null)
     : base(typeId: otDataType.DecimalUnit, isNullable:isNullable, defaultvalue: null, engine: engine, name: name)
 {
     // anonymous name
     if (String.IsNullOrEmpty(name)) this.Name = Guid.NewGuid().ToString();
     this.ComplexTypeName = ConstTypeName; ;
     AddMember(ConstValue, PrimitiveType.GetPrimitiveType(otDataType.Decimal));
     AddMember(ConstUnit, unit);
     _signature = CreateSignature(_structure.Values, isNullable: isNullable, typename: ConstTypeName, name: name);
     // raise event
     RaiseOnCreation(this, datatype: this, engine: engine);
 }