Example #1
0
 /// <summary>
 /// Initialize this DataType with DomainModelContext informations.
 /// For TypeRef(s) this method try to detect a meaningful System.Type.
 /// If it does not succed the System.Type is set to "System.Object".
 /// </summary>
 /// <param name="ctx"></param>
 public override void Initialize(DomainModelContext ctx)
 {
     if (DomainFullName.ToLower() == "object")
         _type = typeof(object);
     else
     {
         try
         {
             _type = ctx.DomainModel.GetClrTypeByNodeTagName(DomainFullName);
             return;
         }
         catch { }
         try
         {
             if (DomainFullName == "object[]")
                 _type = typeof(object[]);
             else if (DomainFullName == "string[]")
                 _type = typeof(string[]);
             else if (DomainFullName == "char[]")
                 _type = typeof(char[]);
             else if (DomainFullName == "bool[]")
                 _type = typeof(bool[]);
             else if (DomainFullName == "int[]")
                 _type = typeof(int[]);
             else if (DomainFullName == "float[]")
                 _type = typeof(float[]);
             else if (DomainFullName == "double[]")
                 _type = typeof(double[]);
             else if (DomainFullName == "decimal[]")
                 _type = typeof(decimal[]);
             else
                 _type = System.Type.GetType(DomainFullName);
             return;
         }
         catch { }
         _type = typeof(object);
     }
 }
Example #2
0
 /// <summary>
 /// Initialize this DataType with DomainModelContext informations.
 /// </summary>
 /// <param name="ctx"></param>
 public virtual void Initialize(DomainModelContext ctx)
 {
 }
Example #3
0
 /// <summary>
 /// Initialize the node.
 /// </summary>
 /// <param name="ctx"></param>
 public override void Initialize(DomainModelContext ctx)
 {
     base.Initialize(ctx);
     DomainDataType = ctx.CreateDataType(Domain);
 }
Example #4
0
 /// <summary>
 /// Executes a single transformation
 /// </summary>
 /// <param name="transformationInfo"></param>
 /// <returns></returns>
 private TransformationResult ExecuteTransformation(TransformationInfo transformationInfo)
 {
     ITransformer transformer = RetrieveTransformer(transformationInfo);
     if (transformer == null)
     {
         throw new FactoryException("Cannot retrieve transformer " + transformationInfo.TransformerName);
     }
     else
     {
         transformer.SetTransformationInfo(transformationInfo);
     }
     IDomainModel model = RetrieveModel(transformationInfo.ModelInfo);
     if (model == null)
     {
         throw new FactoryException("Cannot retrieve domain Model " + transformationInfo.ModelInfo.ToString());
     }
     else
     {
         // initialize the domain model with type system informations
         // target the production context language and data provider
         TypeSystem.TypeSystem typeSystem = RetrieveTypeSystem(
             transformer.TargetLanguage,
             transformer.TargetDataProvider
             );
         DomainModelContext modelContext = new DomainModelContext(null, typeSystem);
         model.Initialize(modelContext);
     }
     // check if the transformer can transform this model
     if (transformer.CanTransform(model))
         // execute transformation passing domain model and production context to the transformer
         return transformer.Transform(model, _productionContext);
     else
         throw new FactoryException("Transformer " + transformationInfo.TransformerName + " cannot transform model " + transformationInfo.ModelInfo.ToString());
 }
Example #5
0
 /// <summary>
 /// Initialize the node and creates the association collection
 /// on the OneSideDomainNodeType and the ManySideDomainNodeType.
 /// </summary>
 /// <param name="ctx"></param>
 public override void Initialize(DomainModelContext ctx)
 {
     base.Initialize(ctx);
     if (Initialized) return;
     Initialized = true;
     MetaDomainModel root = Root as MetaDomainModel;
     if (string.IsNullOrEmpty(Name)) // ParentClassName
     {
         throw new NullReferenceException("Name cannot be null");
     }
     ManySideDomainNodeType = DomainNodeType;
     OneSideDomainNodeType = root.GetDomainNodeTypeByName(Name);
     if (OneSideDomainNodeType == null)
     {
         throw new MetaDomainModelException("Cannot find ParentClassName " + this.Name);
     }
     // Add to association collections on both side
     if (IsOneToOneAssociation)
     {
         OneSideDomainNodeType.OneToOneAssociations.Add(this);
         ManySideDomainNodeType.OneToOneAssociations.Add(this);
     }
     else
     {
         OneSideDomainNodeType.OneToManyAssociations.Add(this);
         ManySideDomainNodeType.ManyToOneAssociations.Add(this);
     }
 }
Example #6
0
 /// <summary>
 /// Initialize the node.
 /// </summary>
 /// <param name="ctx"></param>
 public override void Initialize(DomainModelContext ctx)
 {
     base.Initialize(ctx);
     foreach (DomainNodeType clazz in DomainNodeTypes)
     {
         clazz.Parent = this;
         clazz.Initialize(ctx);
     }
 }
Example #7
0
 /// <summary>
 /// Initialize the node
 /// </summary>
 /// <param name="ctx"></param>
 public override void Initialize(DomainModelContext ctx)
 {
     base.Initialize(ctx);
     foreach (Property p in Properties)
     {
         p.Parent = this;
         p.Initialize(ctx);
     }
     foreach (Reference r in References)
     {
         r.Parent = this;
         r.Initialize(ctx);
     }
 }