Пример #1
0
        /// <inheritdoc />
        public void AddDesignModel(IDesignModel designModel)
        {
            _designModelList.Add(designModel);

            _designModelMap.Add(nameof(IDesignModel.DesignModelType), designModel.DesignModelType, designModel);
            _designModelMap.Add(nameof(IDesignModel.Name), designModel.Name, designModel);
        }
Пример #2
0
 public ClassOutputModelBuilder(string outputModelType, IDesignModel designModel,
                                IClassNamingConvention namingConvention)
 {
     _namingConvention = namingConvention;
     _designModel      = designModel;
     _outputModelType  = outputModelType;
 }
Пример #3
0
 public OutputModelBase(string type, INamespace ns, IDesignModel designModel = null, IProjectFile file = null)
 {
     this.Type                = type;
     this.Namespace           = ns;
     this.DesignModel         = designModel;
     this.File                = file;
     this.OutputConfiguration = new OutputConfiguration.OutputConfiguration(this.Namespace?.OutputConfiguration);
 }
Пример #4
0
 public OutputModelBase(string type, INamespace ns, IDesignModel designModel = null, IProjectFile file = null, OutputModelMergeMode mergeMode = OutputModelMergeMode.Skip)
 {
     Type                = type;
     Namespace           = ns;
     DesignModel         = designModel;
     File                = file;
     OutputConfiguration = new OutputConfiguration.OutputConfiguration(Namespace?.OutputConfiguration);
     MergeMode           = mergeMode;
 }
        public IEnumerable <IOutputModel> GenerateOutputModels(IDesignModel designModel)
        {
            var entity = (Base.Models.Entity.Entity)designModel;

            return(new[] {
                _entityConverter.CreateEntityGeneratedClass(entity, BasePluginConstants.Language_CSharp),
                _entityConverter.CreateEntityCustomClass(entity, BasePluginConstants.Language_CSharp)
            });
        }
Пример #6
0
        public IEnumerable <ITargetPlatform> GetTargetPlatformsForDesignModel(IDesignModel designModel)
        {
            var res = _targetPlatformByDesignModelTypeMap.GetOrNull(designModel.DesignModelType);

            if (res == null && Parent != null)
            {
                return(Parent.GetTargetPlatformsForDesignModel(designModel));
            }

            return(res ?? Enumerable.Empty <ITargetPlatform>());
        }
Пример #7
0
        private static void ParseProperty(IDesignModel designModel, IXmlElementAttribute attribute)
        {
            var definition = attribute.Definition;
            var name       = definition.Name.LocalName;

            if (designModel.GetProperty(name) != null)
            {
                // Property is already defined, so skip attribute.
                return;
            }

            var value    = attribute.Value;
            var property = new DesignModelProperty(definition.Name.LocalName, definition.Type, value, definition, attribute.ParseLocation);

            designModel.AddProperty(property);
        }
Пример #8
0
        public virtual void CopyPropertiesFrom(IDesignModel source, IParseLocationInfo parseLocation = null)
        {
            var propertiesToCopy = source.Properties.Join(
                Element.Definition.Attributes,
                x => x.Name,
                x => x.Name.LocalName,
                (x, y) => new
            {
                x.Name,
                y.Type,
                x.Value,
                Definition = y
            }
                );

            foreach (var entry in propertiesToCopy.Where(x => !_propertyMap.ContainsKey(x.Name)))
            {
                AddProperty(new DesignModelProperty(entry.Name, entry.Type, entry.Value, entry.Definition, parseLocation));
            }
        }
Пример #9
0
 public void AddDesignModel(IDesignModel designModel)
 {
     _designModelsByTypeMap.Add(designModel.DesignModelType, designModel);
 }
Пример #10
0
 public ClassOutputModel(string type, INamespace ns, IDesignModel designModel, IProjectFile file = null) : base(type, ns, designModel, file)
 {
 }
Пример #11
0
 public DesignModelException(IDesignModel model, string message, Exception innerException)
     : base(FormatMessage(model.Element.Definition.Name, model.ParseLocation, message), innerException)
 {
 }