コード例 #1
0
ファイル: ClassModelExtensions.cs プロジェクト: pdeparcq/dgen
        public static void AddViewModelProperty(this ClassModel @class, Property property, ITypeModelRegistry registry)
        {
            TypeModel propertyType;

            if (property.Type.SystemType != null)
            {
                propertyType = SystemTypes.Parse(property.Type.SystemType);
            }
            else if (!(property.Type.Type is Enumeration))
            {
                var viewModel = registry.GetAllBaseTypes <ViewModel>("Application").SingleOrDefault(vm => vm.IsCompact && vm.Target == property.Type.Type);
                propertyType = registry.Resolve("Application", viewModel);
            }
            else
            {
                propertyType = property.Type.Resolve(registry);
            }

            if (property.IsCollection)
            {
                propertyType = SystemTypes.List(propertyType);
            }

            @class.AddProperty(property.Name, propertyType)
            .WithDescription(property.Description);
        }
コード例 #2
0
ファイル: ClassModelExtensions.cs プロジェクト: pdeparcq/dgen
 public static void AddDomainProperty(this ClassModel @class, Property property, ITypeModelRegistry registry)
 {
     @class.AddProperty(property.GetDomainName(), property.GetDomainType(registry))
     .WithDescription(property.Description)
     .MakeReadOnly();
 }