예제 #1
0
        private async Task <IEnumerable <WhereUsedItem> > GetWhereUsed(IAsyncConnection conn, string type, string id)
        {
            var whereUsed = await conn.ApplyAsync(@"<AML>
                                                <Item type='SQL' action='SQL Process'>
                                                  <name>WhereUsed_General</name>
                                                  <PROCESS>CALL</PROCESS>
                                                  <ARG1>@0</ARG1>
                                                  <ARG2>@1</ARG2>
                                                </Item>
                                              </AML>", true, false, type, id).ToTask();

            return((
                       from i in whereUsed.Items()
                       where string.IsNullOrEmpty(type) || i.Property("parent_type").Value == type
                       select new WhereUsedItem()
            {
                Type = i.Property("parent_type").Value,
                Id = i.Property("parent_id").Value,
                Icon = i.Property("icon").Value,
                MainType = i.Property("main_type").Value,
                MainId = i.Property("main_id").Value,
                Properties = i.Elements().OfType <IReadOnlyProperty>()
                             .Where(p => p.Name.Length == 2 && p.Name[0] == 'p' && char.IsNumber(p.Name[1]))
                             .Select(p => p.Value),
                Generation = i.Generation().AsInt(1),
                KeyedName = i.KeyedName().Value,
                MajorRev = i.MajorRev().Value
            }).ToList());
        }
예제 #2
0
 private async Task<IEnumerable<WhereUsedItem>> GetWhereUsed(IAsyncConnection conn, string type, string id)
 {
   var whereUsed = await conn.ApplyAsync(@"<AML>
                                             <Item type='SQL' action='SQL Process'>
                                               <name>WhereUsed_General</name>
                                               <PROCESS>CALL</PROCESS>
                                               <ARG1>@0</ARG1>
                                               <ARG2>@1</ARG2>
                                             </Item>
                                           </AML>", true, false, type, id).ToTask();
   return (
     from i in whereUsed.Items()
     where string.IsNullOrEmpty(type) || i.Property("parent_type").Value == type
     select new WhereUsedItem()
     {
       Type = i.Property("parent_type").Value,
       Id = i.Property("parent_id").Value,
       Icon = i.Property("icon").Value,
       MainType = i.Property("main_type").Value,
       MainId = i.Property("main_id").Value,
       Properties = i.Elements().OfType<IReadOnlyProperty>()
         .Where(p => p.Name.Length == 2 && p.Name[0] == 'p' && char.IsNumber(p.Name[1]))
         .Select(p => p.Value),
       Generation = i.Generation().AsInt(1),
       KeyedName = i.KeyedName().Value,
       MajorRev = i.MajorRev().Value
     }).ToList();
 }
예제 #3
0
        /// <summary>
        /// Fetches the version from the database if it is not already known.
        /// </summary>
        /// <param name="conn">The connection to fetch the version for</param>
        /// <param name="async">Whether to fetch the version asynchronously</param>
        /// <returns>A promise to return the version of the Aras installation.</returns>
        public static IPromise <Version> FetchVersion(this IAsyncConnection conn, bool async)
        {
            var version = (conn as Connection.IArasConnection)?.Version;

            if (version != default(Version) && version.Major > 0)
            {
                return(Promises.Resolved(version));
            }

            return(conn.ApplyAsync(@"<Item type='Variable' action='get' select='name,value'>
        <name condition='like'>Version*</name>
      </Item>", async, false)
                   .Convert(res =>
            {
                var dict = res.Items()
                           .GroupBy(i => i.Property("name").AsString(""))
                           .ToDictionary(g => g.Key, g => g.First().Property("value").Value);

                string majorStr;
                int major;
                string minorStr;
                int minor;
                string servicePackStr;
                int servicePack;
                string buildStr;
                int build;
                if (dict.TryGetValue("VersionMajor", out majorStr) && int.TryParse(majorStr, out major) &&
                    dict.TryGetValue("VersionMinor", out minorStr) && int.TryParse(minorStr, out minor) &&
                    dict.TryGetValue("VersionServicePack", out servicePackStr))
                {
                    if (!dict.TryGetValue("VersionBuild", out buildStr) || !int.TryParse(buildStr, out build))
                    {
                        build = 0;
                    }

                    if (!int.TryParse(servicePackStr.TrimStart('S', 'P'), out servicePack))
                    {
                        servicePack = 0;
                    }

                    return new Version(major, minor, servicePack, build);
                }
                return default(Version);
            }));
        }
예제 #4
0
        /// <summary>
        /// Fetches the version from the database if it is not already known.
        /// </summary>
        /// <param name="conn">The connection to fetch the version for</param>
        /// <param name="async">Whether to fetch the version asynchronously</param>
        /// <returns>A promise to return the version of the Aras installation.</returns>
        public static IPromise <Version> FetchVersion(this IAsyncConnection conn, bool async)
        {
            if (!(conn is Connection.IArasConnection arasConn))
            {
                return(Promises.Resolved(default(Version)));
            }
            var version = arasConn.Version;

            if (version != default(Version))
            {
                return(Promises.Resolved(version));
            }

            return(conn.ApplyAsync(@"<Item type='Variable' action='get' select='name,value'>
        <name condition='like'>Version*</name>
      </Item>", async, false)
                   .Convert(res =>
            {
                var dict = res.Items()
                           .GroupBy(i => i.Property("name").AsString(""))
                           .ToDictionary(g => g.Key, g => g.First().Property("value").Value);

                var major = 0;
                var minor = 0;
                var servicePack = 0;
                var build = 0;
                // int.TryParse will default to 0 on a failure
                // Always set a version with the pieces even if the version doesn't make sense so that we don't repeat retrieval
                var _ = dict.TryGetValue("VersionMajor", out string majorStr) && int.TryParse(majorStr, out major);
                _ = dict.TryGetValue("VersionMinor", out string minorStr) && int.TryParse(minorStr, out minor);
                _ = dict.TryGetValue("VersionServicePack", out string servicePackStr) &&
                    int.TryParse(servicePackStr.TrimStart('S', 'P'), out servicePack);
                _ = dict.TryGetValue("VersionBuild", out string buildStr) && int.TryParse(buildStr, out build);

                version = new Version(major, minor, servicePack, build);
                arasConn.Version = version;
                return version;
            }));
        }
 public virtual void InitializeConnection(IAsyncConnection conn)
 {
   _itemTypes.Clear();
   if (conn != null)
   {
     _conn = conn;
     _conn.ApplyAsync("<AML><Item action=\"get\" type=\"ItemType\" select=\"name\" /><Item action=\"get\" type=\"RelationshipType\" related_expand=\"0\" select=\"related_id,source_id,relationship_id,name\" /></AML>"
       , true, false)
       .Done(r => LoadItemTypes(r.Items()));
   }
 }
        public IPromise <IEnumerable <ListValue> > ListValues(string id)
        {
            IEnumerable <ListValue> result;

            if (_listValues.TryGetValue(id, out result))
            {
                return(Promises.Resolved(result));
            }

            return(_conn.ApplyAsync("<Item type='List' action='get' id='@0' select='id,description,name,label'><Relationships><Item type='Value' action='get' select='label,value' /><Item type='Filter Value' action='get' select='label,value,filter' /></Relationships></Item>"
                                    , true, false, id)
                   .Convert(r =>
            {
                var values = (IEnumerable <ListValue>)r.AssertItem().Relationships()
                             .Select(i => new ListValue()
                {
                    Label = i.Property("label").Value,
                    Value = i.Property("value").Value
                }).ToArray();
                _listValues[id] = values;
                return values;
            }));
        }
예제 #7
0
        public async Task Run()
        {
            var itemTypes = (await _conn.ApplyAsync(@"<Item type='ItemType' action='get' select='id,implementation_type,is_relationship,is_versionable'>
  <Relationships>
    <Item type='Property' action='get' select='name,data_source,data_type,foreign_property(data_type)'>
      <name condition='not in'>'classification','config_id','created_by_id','created_on','css','current_state','generation','is_current','is_released','itemtype','keyed_name','locked_by_id','major_rev','managed_by_id','minor_rev','modified_by_id','modified_on','new_version','not_lockable','owned_by_id','permission_id','state','team_id'</name>
    </Item>
    <Item type='Morphae' action='get' select='related_id' related_expand='0' />
  </Relationships>
</Item>", true, false).ToTask()).Items().OfType <Innovator.Client.Model.ItemType>().ToArray();

            var defaultFactory = new Innovator.Client.DefaultItemFactory();
            //itemTypes = itemTypes.Where(i => defaultFactory.NewItem(_conn.AmlContext, i.IdProp().KeyedName().Value) == null).ToArray();

            var dict           = itemTypes.ToDictionary(i => i.Id());
            var polymorphicIds = new HashSet <string>();
            var links          = new NameValueCollection();

            var files = new List <string>()
            {
                "AssemblyInfo.Version.cs"
            };
            var directories = new string[]
            {
                Path.Combine(_baseDir, "Innovator.Client." + _companyName),
                Path.Combine(_baseDir, "Innovator.Client." + _companyName + "/Properties")
            };

            foreach (var dir in directories)
            {
                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }
            }


            foreach (var itemType in itemTypes.Where(i => i.ImplementationType().Value == "polymorphic"))
            {
                polymorphicIds.Add(itemType.Id());
                var itemTypeLabel = "I" + itemType.IdProp().KeyedName().Value.Replace(" ", "");
                files.Add(itemTypeLabel + ".cs");
                using (var writer = new StreamWriter(Path.Combine(_baseDir, "Innovator.Client." + _companyName + "/" + itemTypeLabel + ".cs")))
                {
                    await writer.WriteAsync(@"using Innovator.Client;
using System;

namespace Innovator.Client.Model
{
  ///<summary>");

                    await writer.WriteAsync("Interface for polymorphic item type " + itemType.IdProp().KeyedName().Value);

                    await writer.WriteAsync(@" </summary>
  public interface ");

                    await writer.WriteAsync(itemTypeLabel);

                    await writer.WriteAsync(@" : IItem
  {
");

                    var versionable = itemType.Relationships("Morphae").All(m => dict[m.RelatedId().Value].IsVersionable().AsBoolean(false));

                    foreach (var prop in itemType
                             .Relationships()
                             .OfType <Innovator.Client.Model.Property>()
                             .Where(p => p.NameProp().Value != "source_id" && p.NameProp().Value != "related_id" && p.NameProp().Value != "id"))
                    {
                        if (!versionable &&
                            (prop.NameProp().Value == "effective_date" || prop.NameProp().Value == "release_date" || prop.NameProp().Value == "superseded_date"))
                        {
                            continue;
                        }

                        await writer.WriteAsync("    /// <summary>Retrieve the <c>");

                        await writer.WriteAsync(prop.NameProp().Value);

                        await writer.WriteAsync("</c> property of the item</summary>\r\n");

                        await writer.WriteAsync("    IProperty_");

                        await writer.WriteAsync(PropType(prop, polymorphicIds));

                        await writer.WriteAsync(" ");

                        await writer.WriteAsync(GetPropName(prop.NameProp().Value, itemTypeLabel.Substring(1)));

                        await writer.WriteLineAsync(@"();");
                    }
                    await writer.WriteAsync(@"  }
}");
                }
                links.Add(itemType.Id(), itemTypeLabel);
                foreach (var poly in itemType.Relationships("Morphae"))
                {
                    links.Add(poly.RelatedId().Value, itemTypeLabel);
                }
            }

            foreach (var itemType in itemTypes)
            {
                var itemTypeLabel = itemType.IdProp().KeyedName().Value.Replace(" ", "");
                files.Add(itemTypeLabel + ".cs");
                using (var writer = new StreamWriter(Path.Combine(_baseDir, "Innovator.Client." + _companyName + "/" + itemTypeLabel + ".cs")))
                {
                    await writer.WriteAsync(@"using Innovator.Client;
using System;

namespace Innovator.Client.Model
{
  ///<summary>");

                    await writer.WriteAsync("Class for the item type " + itemType.IdProp().KeyedName().Value);

                    await writer.WriteAsync(@" </summary>
  [ArasName(""");

                    await writer.WriteAsync(itemType.IdProp().KeyedName().Value);

                    await writer.WriteAsync(@""")]
  public class ");

                    await writer.WriteAsync(itemTypeLabel);

                    await writer.WriteAsync(@" : Item");

                    if (links[itemType.Id()] != null)
                    {
                        await writer.WriteAsync(@", ");

                        await writer.WriteAsync(links.GetValues(itemType.Id()).GroupConcat(", "));
                    }
                    if (itemType.IsRelationship().AsBoolean(false))
                    {
                        var source = itemType.Relationships().OfType <Innovator.Client.Model.Property>().Single(p => p.NameProp().Value == "source_id");
                        if (source.DataSource().KeyedName().HasValue())
                        {
                            await writer.WriteAsync(@", INullRelationship<");

                            await writer.WriteAsync((polymorphicIds.Contains(source.DataSource().Value) ? "I" : "") + source.DataSource().KeyedName().Value.Replace(" ", ""));

                            await writer.WriteAsync(@">");
                        }

                        var related = itemType.Relationships().OfType <Innovator.Client.Model.Property>().Single(p => p.NameProp().Value == "related_id");
                        if (related.DataSource().KeyedName().HasValue())
                        {
                            await writer.WriteAsync(@", IRelationship<");

                            await writer.WriteAsync((polymorphicIds.Contains(source.DataSource().Value) ? "I" : "") + related.DataSource().KeyedName().Value.Replace(" ", ""));

                            await writer.WriteAsync(@">");
                        }
                    }
                    await writer.WriteAsync(@"
  {
    protected ");

                    await writer.WriteAsync(itemTypeLabel);

                    await writer.WriteAsync(@"() { }
    public ");

                    await writer.WriteAsync(itemTypeLabel);

                    await writer.WriteAsync(@"(ElementFactory amlContext, params object[] content) : base(amlContext, content) { }
    static ");

                    await writer.WriteAsync(itemTypeLabel);

                    await writer.WriteAsync("() { Innovator.Client.Item.AddNullItem<");

                    await writer.WriteAsync(itemTypeLabel);

                    await writer.WriteAsync(">(new ");

                    await writer.WriteAsync(itemTypeLabel);

                    await writer.WriteAsync(@" { _attr = ElementAttributes.ReadOnly | ElementAttributes.Null }); }

");

                    foreach (var prop in itemType
                             .Relationships()
                             .OfType <Innovator.Client.Model.Property>()
                             .Where(p => p.NameProp().Value != "source_id" && p.NameProp().Value != "related_id" && p.NameProp().Value != "id"))
                    {
                        await writer.WriteAsync("    /// <summary>Retrieve the <c>");

                        await writer.WriteAsync(prop.NameProp().Value);

                        await writer.WriteAsync("</c> property of the item</summary>\r\n");

                        await writer.WriteAsync("    [ArasName(\"");

                        await writer.WriteAsync(prop.NameProp().Value);

                        await writer.WriteAsync("\")]\r\n");

                        await writer.WriteAsync("    public IProperty_");

                        await writer.WriteAsync(PropType(prop, polymorphicIds));

                        await writer.WriteAsync(" ");

                        await writer.WriteAsync(GetPropName(prop.NameProp().Value, itemTypeLabel));

                        await writer.WriteAsync(@"()
    {
      return this.Property(""");

                        await writer.WriteAsync(prop.NameProp().Value);

                        await writer.WriteAsync(@""");
    }
");
                    }
                    await writer.WriteAsync(@"  }
}");
                }
            }

            files.Add("CorporateItemFactory.cs");
            using (var writer = new StreamWriter(Path.Combine(_baseDir, "Innovator.Client." + _companyName + "/" + "CorporateItemFactory.cs")))
            {
                await writer.WriteAsync(@"using Innovator.Client;
using Innovator.Client.Model;

namespace Innovator.Client.Model
{
  public class CorporateItemFactory : IItemFactory
  {
    private static ElementFactory _local = new ElementFactory(new ServerContext(false), new CorporateItemFactory());
    public static ElementFactory Local { get { return _local; } }

    private static IReadOnlyItem _nullItem = new IReadOnlyItem[] { }.FirstOrNullItem();
    public static IReadOnlyItem NullItem { get { return _nullItem; } }

    private IItemFactory _default = new DefaultItemFactory();

    public Item NewItem(ElementFactory factory, string type)
    {
      switch (type)
      {
");

                foreach (var itemType in itemTypes)
                {
                    var itemTypeLabel = itemType.IdProp().KeyedName().Value.Replace(" ", "");
                    await writer.WriteAsync("        case \"");

                    await writer.WriteAsync(itemType.IdProp().KeyedName().Value);

                    await writer.WriteAsync("\": return new ");

                    await writer.WriteAsync(itemTypeLabel);

                    await writer.WriteAsync("(factory);");

                    await writer.WriteLineAsync();
                }
                await writer.WriteAsync(@"      }

      return _default.NewItem(factory, type);
    }
  }
}");
            }

            using (var writer = new StreamWriter(Path.Combine(_baseDir, "Innovator.Client." + _companyName + "/Innovator.Client." + _companyName + ".csproj")))
            {
                await writer.WriteAsync(@"<?xml version=""1.0"" encoding=""utf-8""?>
<Project ToolsVersion=""14.0"" DefaultTargets=""Build"" xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
  <Import Project=""$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props"" Condition=""Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"" />
  <PropertyGroup>
    <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
    <Configuration Condition="" '$(Configuration)' == '' "">Debug</Configuration>
    <Platform Condition="" '$(Platform)' == '' "">AnyCPU</Platform>
    <ProjectGuid>{779753D2-6514-4A32-B180-D13B4FA61CB3}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>Innovator.Client." + _companyName + @"</RootNamespace>
    <AssemblyName>Innovator.Client." + _companyName + @"</AssemblyName>
    <DefaultLanguage>en-US</DefaultLanguage>
    <FileAlignment>512</FileAlignment>
    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <TargetFrameworkProfile>
    </TargetFrameworkProfile>
    <TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
  </PropertyGroup>
  <PropertyGroup Condition="" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition="" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <!-- A reference to the entire .NET Framework is automatically included -->
    <None Include=""project.json"" />
  </ItemGroup>
  <ItemGroup>
");

                files.Sort();
                foreach (var file in files)
                {
                    await writer.WriteAsync("    <Compile Include=\"");

                    await writer.WriteAsync(file);

                    await writer.WriteAsync("\" />");

                    await writer.WriteLineAsync();
                }
                await writer.WriteAsync(@"  </ItemGroup>
  <Import Project=""$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets"" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name=""BeforeBuild"">
  </Target>
  <Target Name=""AfterBuild"">
  </Target>
  -->
</Project>");
            }

            using (var writer = new StreamWriter(Path.Combine(_baseDir, "Innovator.Client." + _companyName + "/Properties/AssemblyInfo.cs")))
            {
                await writer.WriteAsync(@"using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle(""Innovator.Client.");

                await writer.WriteAsync(_companyName);

                await writer.WriteAsync(@""")]
[assembly: AssemblyDescription(""Client models for an Aras Innovator installation"")]
[assembly: AssemblyConfiguration("""")]
[assembly: AssemblyCompany("""")]
[assembly: AssemblyProduct(""Innovator.Client.");

                await writer.WriteAsync(_companyName);

                await writer.WriteAsync(@""")]
[assembly: AssemblyCopyright(""Copyright © 2017"")]
[assembly: AssemblyTrademark("""")]
[assembly: AssemblyCulture("""")]
[assembly: NeutralResourcesLanguage(""en"")]");
            }

            using (var writer = new StreamWriter(Path.Combine(_baseDir, "Innovator.Client." + _companyName + "/AssemblyInfo.Version.cs")))
            {
                await writer.WriteAsync(@"using System.Reflection;

[assembly: AssemblyVersion(""1.0.6213.30600"")]
[assembly: AssemblyFileVersion(""1.0.6213.30600"")]
");
            }

            var projJson = @"{
  ""version"": ""1.0.6213.30600"",
  ""title"": ""Innovator.Client.Corporate"",
  ""supports"": {},
  ""frameworks"": {
    ""net35"": {
      ""dependencies"": {
        ""Innovator.Client"": ""2017.1.3.420""
      }
    },
    ""net40"": {
      ""dependencies"": {
        ""Innovator.Client"": ""2017.1.3.420""
      }
    },
    ""net45"": {
      ""dependencies"": {
        ""Innovator.Client"": ""2017.1.3.420""
      }
    },
    ""netstandard1.1"":
    {
      ""dependencies"": {
        ""Microsoft.NETCore.Portable.Compatibility"": ""1.0.1"",
        ""NETStandard.Library"": ""1.6.0"",
        ""Innovator.Client"": ""2017.1.3.420""
      }
    },
    ""netstandard1.3"":
    {
      ""dependencies"": {
        ""Microsoft.NETCore.Portable.Compatibility"": ""1.0.1"",
        ""NETStandard.Library"": ""1.6.0"",
        ""Innovator.Client"": ""2017.1.3.420""
      }
    }
  }
}".Replace("Innovator.Client.Corporate", "Innovator.Client." + _companyName);

            using (var writer = new StreamWriter(Path.Combine(_baseDir, "Innovator.Client." + _companyName + "/project.json")))
            {
                await writer.WriteAsync(projJson);
            }

            var build = @"<#
.SYNOPSIS
  This is a helper function that runs a scriptblock and checks the PS variable $lastexitcode
  to see if an error occcured. If an error is detected then an exception is thrown.
  This function allows you to run command-line programs without having to
  explicitly check the $lastexitcode variable.
.EXAMPLE
  exec { svn info $repository_trunk } ""Error executing SVN. Please verify SVN command-line client is installed""
#>

$epoch = Get-Date -Date ""2000-01-01 00:00:00Z""
$epoch = $epoch.ToUniversalTime()
$now = [System.DateTime]::UtcNow
$span = NEW-TIMESPAN -Start $epoch -End $now
$days = [int]$span.TotalDays
$span = NEW-TIMESPAN -Start $now.Date -End $now
$seconds = [int]($span.TotalSeconds / 2)

$version = ""1.0.$days.$seconds""

$assyInfo = ""using System.Reflection;`r`n`r`n[assembly: AssemblyVersion(""""$version"""")]`r`n[assembly: AssemblyFileVersion(""""$version"""")]""

$assyInfo | Out-File Innovator.Client.Corporate\AssemblyInfo.Version.cs

(Get-Content Innovator.Client.Corporate/project.json) `
    -replace '""version"": ""\d+\.\d+\.\d+\.\d+"",', """"""version"""": """"$version"""","" |
  Out-File Innovator.Client.Corporate/project.json

function Exec
{
    [CmdletBinding()]
    param(
        [Parameter(Position=0,Mandatory=1)][scriptblock]$cmd,
        [Parameter(Position=1,Mandatory=0)][string]$errorMessage = ($msgs.error_bad_command -f $cmd)
    )
    & $cmd
    if ($lastexitcode -ne 0) {
        throw (""Exec: "" + $errorMessage)
    }
}

exec { & dotnet restore }
exec { & dotnet pack Innovator.Client.Corporate/project.json -c Release -o .\artifacts --version-suffix=$version }  ".Replace("Innovator.Client.Corporate", "Innovator.Client." + _companyName);

            using (var writer = new StreamWriter(Path.Combine(_baseDir, "build.ps1")))
            {
                await writer.WriteAsync(build);
            }

            using (var writer = new StreamWriter(Path.Combine(_baseDir, "Innovator.Client." + _companyName + ".sln")))
            {
                await writer.WriteAsync(@"
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project(""{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"") = ""Innovator.Client.");

                await writer.WriteAsync(_companyName);

                await writer.WriteAsync(@""", ""Innovator.Client.");

                await writer.WriteAsync(_companyName);

                await writer.WriteAsync(@"\Innovator.Client.");

                await writer.WriteAsync(_companyName);

                await writer.WriteAsync(@".csproj"", ""{779753D2-6514-4A32-B180-D13B4FA61CB3}""
EndProject
Global
  GlobalSection(SolutionConfigurationPlatforms) = preSolution
    Debug|Any CPU = Debug|Any CPU
    Release|Any CPU = Release|Any CPU
  EndGlobalSection
  GlobalSection(ProjectConfigurationPlatforms) = postSolution
    {779753D2-6514-4A32-B180-D13B4FA61CB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    {779753D2-6514-4A32-B180-D13B4FA61CB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
    {779753D2-6514-4A32-B180-D13B4FA61CB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
    {779753D2-6514-4A32-B180-D13B4FA61CB3}.Release|Any CPU.Build.0 = Release|Any CPU
  EndGlobalSection
  GlobalSection(SolutionProperties) = preSolution
    HideSolutionNode = FALSE
  EndGlobalSection
EndGlobal
");
            }
        }
예제 #8
0
    public async Task<string> ExecuteAsync(IAsyncConnection conn)
    {
      var defaultProps = new List<string>() {
        "classification",
        "config_id",
        "created_by_id",
        "created_on",
        "css",
        "current_state",
        "effective_date",
        "generation",
        "id",
        "is_current",
        "is_released",
        "keyed_name",
        "locked_by_id",
        "major_rev",
        "managed_by_id",
        "minor_rev",
        "modified_by_id",
        "modified_on",
        "new_version",
        "not_lockable",
        "owned_by_id",
        "permission_id",
        "release_date",
        "state",
        "superseded_date",
        "team_id",
        "related_id",
        "source_id",
        "behavior",
        "itemtype"
      };
      if (!this.IncludeSortOrder)
        defaultProps.Add("sort_order");

      var info = await conn.ApplyAsync(@"<AML>
                                          <Item type='ItemType' action='get'>
                                            <name>@0</name>
                                            <Relationships>
                                              <Item action='get' type='Property' select='label,name,is_required,is_class_required,data_type,data_source,readonly,pattern,stored_length,foreign_property(label,name,is_required,is_class_required,data_type,data_source,readonly,pattern,stored_length)'></Item>
                                            </Relationships>
                                          </Item>
                                        </AML>", true, true, this.ItemType).ToTask();
      var itemTypeInfo = info.AssertItem();
      var itemProps = new List<ArasProperty>();
      var classBuilder = new StringBuilder();
      var polyItem = itemTypeInfo.Property("implementation_type").AsString("") == "polymorphic";

      if (!this.IsBase) classBuilder.AppendLine("Imports Gentex.ComponentTracker.Model");
      classBuilder.AppendLine("Imports Gentex.Data.Aras.Model");
      classBuilder.AppendLine("Imports Gentex.Data.Base.Model");
      classBuilder.AppendLine();
      if (this.IsBase)
        classBuilder.AppendLine("Namespace Aras.Model");
      else
        classBuilder.AppendLine("Namespace Model");
      classBuilder.AppendFormat(@"  <SourceName(""{0}"")> _", this.ItemType).AppendLine();
      if (itemTypeInfo.Property("is_relationship").AsBoolean(false))
      {
        classBuilder.AppendFormat("  Public Class {0}", Strings.StrConv(this.ItemType, VbStrConv.ProperCase).Replace(" ", "")).AppendLine();
        var rel = await conn.ApplyAsync(@"<AML>
                                            <Item type='RelationshipType' action='get' select='source_id,related_id' related_expand='0'>
                                              <relationship_id>@0</relationship_id>
                                            </Item>
                                          </AML>", true, true, itemTypeInfo.Id()).ToTask();
        var relTypeInfo = rel.AssertItem();
        if (!relTypeInfo.RelatedId().KeyedName().HasValue())
          classBuilder.AppendFormat("    Inherits NullRelationship(Of {0})",
                                    Strings.StrConv(relTypeInfo.SourceId().Attribute("name").Value, VbStrConv.ProperCase).Replace(" ", ""))
                      .AppendLine();
        else
          classBuilder.AppendFormat("    Inherits Relationship(Of {0}, {1})",
                                    Strings.StrConv(relTypeInfo.SourceId().Attribute("name").Value, VbStrConv.ProperCase).Replace(" ", ""),
                                    Strings.StrConv(relTypeInfo.RelatedId().Attribute("name").Value, VbStrConv.ProperCase).Replace(" ", ""))
                      .AppendLine();
      }
      else if (polyItem)
      {
        classBuilder.AppendFormat("  Public Interface I{0}", Strings.StrConv(this.ItemType, VbStrConv.ProperCase).Replace(" ", "")).AppendLine();
        if (itemTypeInfo.Property("is_versionable").AsBoolean(false))
          classBuilder.AppendLine("    Inherits IVersionableItem");
        else
          classBuilder.AppendLine("    Inherits IItem");
      }
      else
      {
        classBuilder.AppendFormat("  Public Class {0}", Strings.StrConv(this.ItemType, VbStrConv.ProperCase).Replace(" ", "")).AppendLine();
        if (itemTypeInfo.Property("is_versionable").AsBoolean(false))
          classBuilder.AppendLine("    Inherits VersionableItem");
        else
          classBuilder.AppendLine("    Inherits Item");
      }
      classBuilder.AppendLine();

      ArasProperty arasProp;
      foreach (var prop in itemTypeInfo.Relationships("Property"))
      {
        if (!defaultProps.Contains(prop.Property("name").AsString("")))
        {
          arasProp = await ArasProperty.NewProp(prop, conn);
          itemProps.Add(arasProp);
        }
      }

      if (!polyItem)
      {
        itemProps.Sort(SortVariable);
        foreach (var prop in itemProps)
        {
          if (prop.PropType == ArasProperty.PropTypes.ReadOnly)
          {
            classBuilder.AppendFormat(@"    Private {0} As New ReadOnlyPropertyValue(Of {1})(""{2}"", Me)", prop.VarName, prop.DataType, prop.Name).AppendLine();
          }
          else if (prop.PropType == ArasProperty.PropTypes.Normal)
          {
            classBuilder.AppendFormat(@"    Private {0} As New PropertyValue(Of {1})(""{2}"", Me, {3})", prop.VarName, prop.DataType, prop.Name, prop.Required).AppendLine();
          }
        }
        classBuilder.AppendLine();

        var foreignProps = itemProps.Where(p => p.PropType == ArasProperty.PropTypes.Foreign);
        if (foreignProps.Any())
        {
          foreach (var prop in foreignProps)
          {
            classBuilder.AppendFormat(@"    Private {0} As New ForeignPropertyValue(Of {1}, {2})(""{3}"", Me, {4}, Function(item) item.{5})"
              , prop.VarName, prop.ForeignLinkProp.DataType, prop.DataType, prop.Name, prop.ForeignLinkProp.VarName, prop.ForeignProp.PropName)
              .AppendLine();
          }
          classBuilder.AppendLine();
        }
      }

      itemProps.Sort(SortProperty);
      foreach (var prop in itemProps)
      {
        classBuilder.AppendLine("    ''' <summary>");
        classBuilder.AppendFormat("    ''' Gets the {0}.", prop.Label.ToLower().Replace("&", "&amp;")).AppendLine();
        classBuilder.AppendLine("    ''' </summary>");

        classBuilder.AppendFormat(@"    <DisplayName(""{0}""), SourceName(""{1}"")", prop.Label, prop.Name);
        if (!String.IsNullOrEmpty(prop.List))
        {
          classBuilder.AppendFormat(@", List(""{0}""", prop.List);
          if (!String.IsNullOrEmpty(prop.ListFilter))
          {
            classBuilder.AppendFormat(@", ""{0}""", prop.ListFilter);
          }
          if (prop.EbsList)
          {
            if (String.IsNullOrEmpty(prop.ListFilter)) classBuilder.Append(", ");
            classBuilder.Append(", True");
          }
          classBuilder.Append(")");
        }
        if (prop.StringLength > 0)
          classBuilder.AppendFormat(", StringField({0})", prop.StringLength);
        classBuilder.Append(">");
        classBuilder.AppendLine();

        classBuilder.Append("    ");
        if (!polyItem) classBuilder.Append("Public ");

        switch (prop.PropType)
        {
          case ArasProperty.PropTypes.ReadOnly:
            classBuilder.AppendFormat("ReadOnly Property {0} As ReadOnlyPropertyValue(Of {1})", prop.PropName, prop.DataType).AppendLine();
            break;
          case ArasProperty.PropTypes.Foreign:
            classBuilder.AppendFormat("ReadOnly Property {0} As IPropertyValue(Of {1})", prop.PropName, prop.DataType).AppendLine();
            break;
          default:
            classBuilder.AppendFormat("ReadOnly Property {0} As PropertyValue(Of {1})", prop.PropName, prop.DataType).AppendLine();
            break;
        }

        if (!polyItem)
        {
          classBuilder.AppendLine("      Get");
          classBuilder.AppendFormat("        Return {0}", prop.VarName).AppendLine();
          classBuilder.AppendLine("      End Get");
          classBuilder.AppendLine("    End Property");
        }
      }

      classBuilder.AppendLine();
      if (polyItem)
      {
        classBuilder.AppendLine("  End Interface");
      }
      else
      {
        if (this.IsBase)
          classBuilder.AppendLine("    Public Sub New(ByVal builder As Base.Model.IModelBuilder)");
        else
          classBuilder.AppendLine("    Public Sub New(ByVal builder As IModelBuilder)");

        classBuilder.AppendLine("      MyBase.New(builder)");
        classBuilder.AppendLine("    End Sub");

        if (this.GetProperties)
        {
          classBuilder.AppendLine();
          classBuilder.AppendLine("    Private _getter As New PropGetter(Me)");
          classBuilder.AppendLine("    Protected Overrides Function GetPropertyGetter() As Gentex.Data.Base.Model.IModelPropertyGetter");
          classBuilder.AppendLine("      Return _getter");
          classBuilder.AppendLine("    End Function");
          classBuilder.AppendLine();
          classBuilder.AppendLine("    Private Class PropGetter");
          classBuilder.AppendLine("      Implements IModelPropertyGetter");
          classBuilder.AppendLine();
          classBuilder.AppendFormat("      Private _parent As {0}", Strings.StrConv(this.ItemType, VbStrConv.ProperCase).Replace(" ", "")).AppendLine();
          classBuilder.AppendLine();
          classBuilder.AppendLine("      Public ReadOnly Property SupportsByName As Boolean Implements IModelPropertyGetter.SupportsByName");
          classBuilder.AppendLine("        Get");
          classBuilder.AppendLine("          Return True");
          classBuilder.AppendLine("        End Get");
          classBuilder.AppendLine("      End Property");
          classBuilder.AppendLine();
          classBuilder.AppendFormat("      Public Sub New(parent as {0})", Strings.StrConv(this.ItemType, VbStrConv.ProperCase).Replace(" ", "")).AppendLine();
          classBuilder.AppendLine("        _parent = parent");
          classBuilder.AppendLine("      End Sub");
          classBuilder.AppendLine();
          classBuilder.AppendLine("      Public Function GetEnumerator() As System.Collections.Generic.IEnumerator(Of PropertyValueInfo) Implements System.Collections.Generic.IEnumerable(Of Gentex.Data.Base.Model.PropertyValueInfo).GetEnumerator");
          classBuilder.AppendLine("        Dim props As New List(Of Data.Base.Model.PropertyValueInfo)");
          itemProps.Sort((x, y) => x.VarName.CompareTo(y.VarName));
          foreach (var prop in itemProps)
          {
            classBuilder.AppendLine(String.Format("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent.{0}, Nothing))", prop.VarName));
          }
          classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._configId, Nothing))");
          classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._generation, Nothing))");
          classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._isCurrent, Nothing))");
          classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._isReleased, Nothing))");
          classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._majorRev, Nothing))");
          classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._minorRev, Nothing))");
          classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._releaseDate, Nothing))");
          classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._supersededDate, Nothing))");
          classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._classification, Nothing))");
          classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._createdBy, Nothing))");
          classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._createdOn, Nothing))");
          classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._currentState, Nothing))");
          classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._effectiveDate, Nothing))");
          classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._lockedBy, Nothing))");
          classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._managedBy, Nothing))");
          classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._modifiedBy, Nothing))");
          classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._modifiedOn, Nothing))");
          classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._notLockable, Nothing))");
          classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._ownedBy, Nothing))");
          classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._permission, Nothing))");
          classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._state, Nothing))");
          classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._team, Nothing))");
          classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._id, Nothing))");
          classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._keyedName, Nothing))");
          classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._canDelete, New LazyLoadAttribute(True, False)))");
          classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._canUpdate, New LazyLoadAttribute(True, False)))");
          classBuilder.AppendLine("        Return props");
          classBuilder.AppendLine("      End Function");
          classBuilder.AppendLine();
          classBuilder.AppendLine("      Public Function ByName(name As String) As Base.Model.PropertyValueInfo Implements Gentex.Data.Base.Model.IModelPropertyGetter.ByName");
          classBuilder.AppendLine("        Select Case name");
          foreach (var prop in itemProps)
          {
            classBuilder.AppendLine(String.Format(@"          Case ""{0}""", prop.Name));
            classBuilder.AppendLine(String.Format("            Return New Data.Base.Model.PropertyValueInfo(_parent.{0}, Nothing)", prop.VarName));
          }
          classBuilder.AppendLine("          Case Field_ConfigId");
          classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._configId, Nothing)");
          classBuilder.AppendLine("          Case Field_Generation");
          classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._generation, Nothing)");
          classBuilder.AppendLine("          Case \"is_current\"");
          classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._isCurrent, Nothing)");
          classBuilder.AppendLine("          Case \"is_released\"");
          classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._isReleased, Nothing)");
          classBuilder.AppendLine("          Case Field_MajorRev");
          classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._majorRev, Nothing)");
          classBuilder.AppendLine("          Case Field_MinorRev");
          classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._minorRev, Nothing)");
          classBuilder.AppendLine("          Case \"release_date\"");
          classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._releaseDate, Nothing)");
          classBuilder.AppendLine("          Case \"superseded_date\"");
          classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._supersededDate, Nothing)");
          classBuilder.AppendLine("          Case Field_Classification");
          classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._classification, Nothing)");
          classBuilder.AppendLine("          Case \"created_by_id\"");
          classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._createdBy, Nothing)");
          classBuilder.AppendLine("          Case \"created_on\"");
          classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._createdOn, Nothing)");
          classBuilder.AppendLine("          Case \"current_state\"");
          classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._currentState, Nothing)");
          classBuilder.AppendLine("          Case \"effective_date\"");
          classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._effectiveDate, Nothing)");
          classBuilder.AppendLine("          Case \"locked_by_id\"");
          classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._lockedBy, Nothing)");
          classBuilder.AppendLine("          Case \"managed_by_id\"");
          classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._managedBy, Nothing)");
          classBuilder.AppendLine("          Case \"modified_by_id\"");
          classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._modifiedBy, Nothing)");
          classBuilder.AppendLine("          Case \"modified_on\"");
          classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._modifiedOn, Nothing)");
          classBuilder.AppendLine("          Case \"not_lockable\"");
          classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._notLockable, Nothing)");
          classBuilder.AppendLine("          Case \"owned_by_id\"");
          classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._ownedBy, Nothing)");
          classBuilder.AppendLine("          Case \"permission_id\"");
          classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._permission, Nothing)");
          classBuilder.AppendLine("          Case Field_State");
          classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._state, Nothing)");
          classBuilder.AppendLine("          Case \"team_id\"");
          classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._team, Nothing)");
          classBuilder.AppendLine("          Case Field_PermissionCanDelete");
          classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._canDelete, New LazyLoadAttribute(True, False))");
          classBuilder.AppendLine("          Case Field_PermissionCanUpdate");
          classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._canUpdate, New LazyLoadAttribute(True, False))");
          classBuilder.AppendLine("          Case Field_Id");
          classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._id, Nothing)");
          classBuilder.AppendLine("          Case Field_KeyedName");
          classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._keyedName, Nothing)");
          classBuilder.AppendLine("          Case Else");
          classBuilder.AppendLine("            Return Nothing");
          classBuilder.AppendLine("        End Select");
          classBuilder.AppendLine("      End Function");
          classBuilder.AppendLine();
          classBuilder.AppendLine("      Private Function GetEnumeratorCore() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator");
          classBuilder.AppendLine("        Return GetEnumerator()");
          classBuilder.AppendLine("      End Function");
          classBuilder.AppendLine("    End Class");
        }

        classBuilder.AppendLine("  End Class");
      }
      classBuilder.AppendLine("End Namespace");
      return classBuilder.ToString();
    }
예제 #9
0
      public async Task Initialize(IReadOnlyItem item, IAsyncConnection conn)
      {
        this.Label = item.Property("label").AsString("");
        this.Name = item.Property("name").AsString("");
        this.Required = item.Property("is_required").AsBoolean(false)
          || item.Property("is_class_required").AsBoolean(false);
        this.PropName = LabelToProp(this.Label);
        this.VarName = NameToVar(this.Name);

        if (string.IsNullOrEmpty(this.PropName))
          this.PropName = LabelToProp(this.Name);
        if (string.IsNullOrEmpty(this.Label))
          this.Label = Strings.StrConv(this.Name.Replace('_', ' '), VbStrConv.ProperCase);

        if (item.Property("data_type").Value == "foreign")
        {
          this.PropType = PropTypes.Foreign;
          if (!item.Property("foreign_property").HasValue())
          {
            var result = await conn.ApplyAsync(@"<AML>
                                            <Item type='Property' action='get' id='@0' select='label,name,is_required,is_class_required,data_type,data_source,readonly,pattern,stored_length,foreign_property(label,name,is_required,is_class_required,data_type,data_source,readonly,pattern,stored_length)'>
                                            </Item>
                                          </AML>", true, true, item.Id()).ToTask();
            item = result.AssertItem();
          }
          ForeignProp = await NewProp(item.Property("foreign_property").AsItem(), conn);
          ForeignLinkProp = NewProp(item.Property("data_source").Value);
        }
        else if (item.Property("readonly").AsBoolean(false))
        {
          PropType = PropTypes.ReadOnly;
        }
        else
        {
          PropType = PropTypes.Normal;
        }

        if (this.ForeignProp != null)
        {
          this.DataType = ForeignProp.DataType;
        }
        else
        {
          switch (item.Property("data_type").AsString("").ToLowerInvariant())
          {
            case "decimal":
            case "float":
              DataType = "Double";
              break;
            case "date":
              DataType = "Date";
              break;
            case "item":
              DataType = Strings.StrConv(item.Property("data_source").KeyedName().Value, VbStrConv.ProperCase)
                .Replace(" ", "");
              if (item.Property("data_source").Value == "0C8A70AE86AF49AD873F817593F893D4")
              {
                this.List = item.Property("pattern").AsString("");
                this.EbsList = true;
              }
              break;
            case "integer":
              DataType = "Integer";
              break;
            case "boolean":
              DataType = "Boolean";
              break;
            case "list":
            case "filter list":
            case "mv_list":
              DataType = "String";
              this.List = item.Property("data_source").AsString("");
              this.ListFilter = item.Property("pattern").AsString("");
              break;
            case "image":
              DataType = "Gentex.Drawing.WebLazyImage";
              break;
            default: //"list", "string", "text"
              this.StringLength = item.Property("stored_length").AsInt(-1);
              this.DataType = "String";
              break;
          }
        }
      }
예제 #10
0
        public async Task <string> ExecuteAsync(IAsyncConnection conn)
        {
            var defaultProps = new List <string>()
            {
                "classification",
                "config_id",
                "created_by_id",
                "created_on",
                "css",
                "current_state",
                "effective_date",
                "generation",
                "id",
                "is_current",
                "is_released",
                "keyed_name",
                "locked_by_id",
                "major_rev",
                "managed_by_id",
                "minor_rev",
                "modified_by_id",
                "modified_on",
                "new_version",
                "not_lockable",
                "owned_by_id",
                "permission_id",
                "release_date",
                "state",
                "superseded_date",
                "team_id",
                "related_id",
                "source_id",
                "behavior",
                "itemtype"
            };

            if (!this.IncludeSortOrder)
            {
                defaultProps.Add("sort_order");
            }

            var info = await conn.ApplyAsync(@"<AML>
                                          <Item type='ItemType' action='get'>
                                            <name>@0</name>
                                            <Relationships>
                                              <Item action='get' type='Property' select='label,name,is_required,is_class_required,data_type,data_source,readonly,pattern,stored_length,foreign_property(label,name,is_required,is_class_required,data_type,data_source,readonly,pattern,stored_length)'></Item>
                                            </Relationships>
                                          </Item>
                                        </AML>", true, true, this.ItemType).ToTask();

            var itemTypeInfo = info.AssertItem();
            var itemProps    = new List <ArasProperty>();
            var classBuilder = new StringBuilder();
            var polyItem     = itemTypeInfo.Property("implementation_type").AsString("") == "polymorphic";

            if (!this.IsBase)
            {
                classBuilder.AppendLine("Imports Gentex.ComponentTracker.Model");
            }
            classBuilder.AppendLine("Imports Gentex.Data.Aras.Model");
            classBuilder.AppendLine("Imports Gentex.Data.Base.Model");
            classBuilder.AppendLine();
            if (this.IsBase)
            {
                classBuilder.AppendLine("Namespace Aras.Model");
            }
            else
            {
                classBuilder.AppendLine("Namespace Model");
            }
            classBuilder.AppendFormat(@"  <SourceName(""{0}"")> _", this.ItemType).AppendLine();
            if (itemTypeInfo.Property("is_relationship").AsBoolean(false))
            {
                classBuilder.AppendFormat("  Public Class {0}", Strings.StrConv(this.ItemType, VbStrConv.ProperCase).Replace(" ", "")).AppendLine();
                var rel = await conn.ApplyAsync(@"<AML>
                                            <Item type='RelationshipType' action='get' select='source_id,related_id' related_expand='0'>
                                              <relationship_id>@0</relationship_id>
                                            </Item>
                                          </AML>", true, true, itemTypeInfo.Id()).ToTask();

                var relTypeInfo = rel.AssertItem();
                if (!relTypeInfo.RelatedId().KeyedName().HasValue())
                {
                    classBuilder.AppendFormat("    Inherits NullRelationship(Of {0})",
                                              Strings.StrConv(relTypeInfo.SourceId().Attribute("name").Value, VbStrConv.ProperCase).Replace(" ", ""))
                    .AppendLine();
                }
                else
                {
                    classBuilder.AppendFormat("    Inherits Relationship(Of {0}, {1})",
                                              Strings.StrConv(relTypeInfo.SourceId().Attribute("name").Value, VbStrConv.ProperCase).Replace(" ", ""),
                                              Strings.StrConv(relTypeInfo.RelatedId().Attribute("name").Value, VbStrConv.ProperCase).Replace(" ", ""))
                    .AppendLine();
                }
            }
            else if (polyItem)
            {
                classBuilder.AppendFormat("  Public Interface I{0}", Strings.StrConv(this.ItemType, VbStrConv.ProperCase).Replace(" ", "")).AppendLine();
                if (itemTypeInfo.Property("is_versionable").AsBoolean(false))
                {
                    classBuilder.AppendLine("    Inherits IVersionableItem");
                }
                else
                {
                    classBuilder.AppendLine("    Inherits IItem");
                }
            }
            else
            {
                classBuilder.AppendFormat("  Public Class {0}", Strings.StrConv(this.ItemType, VbStrConv.ProperCase).Replace(" ", "")).AppendLine();
                if (itemTypeInfo.Property("is_versionable").AsBoolean(false))
                {
                    classBuilder.AppendLine("    Inherits VersionableItem");
                }
                else
                {
                    classBuilder.AppendLine("    Inherits Item");
                }
            }
            classBuilder.AppendLine();

            ArasProperty arasProp;

            foreach (var prop in itemTypeInfo.Relationships("Property"))
            {
                if (!defaultProps.Contains(prop.Property("name").AsString("")))
                {
                    arasProp = await ArasProperty.NewProp(prop, conn);

                    itemProps.Add(arasProp);
                }
            }

            if (!polyItem)
            {
                itemProps.Sort(SortVariable);
                foreach (var prop in itemProps)
                {
                    if (prop.PropType == ArasProperty.PropTypes.ReadOnly)
                    {
                        classBuilder.AppendFormat(@"    Private {0} As New ReadOnlyPropertyValue(Of {1})(""{2}"", Me)", prop.VarName, prop.DataType, prop.Name).AppendLine();
                    }
                    else if (prop.PropType == ArasProperty.PropTypes.Normal)
                    {
                        classBuilder.AppendFormat(@"    Private {0} As New PropertyValue(Of {1})(""{2}"", Me, {3})", prop.VarName, prop.DataType, prop.Name, prop.Required).AppendLine();
                    }
                }
                classBuilder.AppendLine();

                var foreignProps = itemProps.Where(p => p.PropType == ArasProperty.PropTypes.Foreign);
                if (foreignProps.Any())
                {
                    foreach (var prop in foreignProps)
                    {
                        classBuilder.AppendFormat(@"    Private {0} As New ForeignPropertyValue(Of {1}, {2})(""{3}"", Me, {4}, Function(item) item.{5})"
                                                  , prop.VarName, prop.ForeignLinkProp.DataType, prop.DataType, prop.Name, prop.ForeignLinkProp.VarName, prop.ForeignProp.PropName)
                        .AppendLine();
                    }
                    classBuilder.AppendLine();
                }
            }

            itemProps.Sort(SortProperty);
            foreach (var prop in itemProps)
            {
                classBuilder.AppendLine("    ''' <summary>");
                classBuilder.AppendFormat("    ''' Gets the {0}.", prop.Label.ToLower().Replace("&", "&amp;")).AppendLine();
                classBuilder.AppendLine("    ''' </summary>");

                classBuilder.AppendFormat(@"    <DisplayName(""{0}""), SourceName(""{1}"")", prop.Label, prop.Name);
                if (!String.IsNullOrEmpty(prop.List))
                {
                    classBuilder.AppendFormat(@", List(""{0}""", prop.List);
                    if (!String.IsNullOrEmpty(prop.ListFilter))
                    {
                        classBuilder.AppendFormat(@", ""{0}""", prop.ListFilter);
                    }
                    if (prop.EbsList)
                    {
                        if (String.IsNullOrEmpty(prop.ListFilter))
                        {
                            classBuilder.Append(", ");
                        }
                        classBuilder.Append(", True");
                    }
                    classBuilder.Append(")");
                }
                if (prop.StringLength > 0)
                {
                    classBuilder.AppendFormat(", StringField({0})", prop.StringLength);
                }
                classBuilder.Append(">");
                classBuilder.AppendLine();

                classBuilder.Append("    ");
                if (!polyItem)
                {
                    classBuilder.Append("Public ");
                }

                switch (prop.PropType)
                {
                case ArasProperty.PropTypes.ReadOnly:
                    classBuilder.AppendFormat("ReadOnly Property {0} As ReadOnlyPropertyValue(Of {1})", prop.PropName, prop.DataType).AppendLine();
                    break;

                case ArasProperty.PropTypes.Foreign:
                    classBuilder.AppendFormat("ReadOnly Property {0} As IPropertyValue(Of {1})", prop.PropName, prop.DataType).AppendLine();
                    break;

                default:
                    classBuilder.AppendFormat("ReadOnly Property {0} As PropertyValue(Of {1})", prop.PropName, prop.DataType).AppendLine();
                    break;
                }

                if (!polyItem)
                {
                    classBuilder.AppendLine("      Get");
                    classBuilder.AppendFormat("        Return {0}", prop.VarName).AppendLine();
                    classBuilder.AppendLine("      End Get");
                    classBuilder.AppendLine("    End Property");
                }
            }

            classBuilder.AppendLine();
            if (polyItem)
            {
                classBuilder.AppendLine("  End Interface");
            }
            else
            {
                if (this.IsBase)
                {
                    classBuilder.AppendLine("    Public Sub New(ByVal builder As Base.Model.IModelBuilder)");
                }
                else
                {
                    classBuilder.AppendLine("    Public Sub New(ByVal builder As IModelBuilder)");
                }

                classBuilder.AppendLine("      MyBase.New(builder)");
                classBuilder.AppendLine("    End Sub");

                if (this.GetProperties)
                {
                    classBuilder.AppendLine();
                    classBuilder.AppendLine("    Private _getter As New PropGetter(Me)");
                    classBuilder.AppendLine("    Protected Overrides Function GetPropertyGetter() As Gentex.Data.Base.Model.IModelPropertyGetter");
                    classBuilder.AppendLine("      Return _getter");
                    classBuilder.AppendLine("    End Function");
                    classBuilder.AppendLine();
                    classBuilder.AppendLine("    Private Class PropGetter");
                    classBuilder.AppendLine("      Implements IModelPropertyGetter");
                    classBuilder.AppendLine();
                    classBuilder.AppendFormat("      Private _parent As {0}", Strings.StrConv(this.ItemType, VbStrConv.ProperCase).Replace(" ", "")).AppendLine();
                    classBuilder.AppendLine();
                    classBuilder.AppendLine("      Public ReadOnly Property SupportsByName As Boolean Implements IModelPropertyGetter.SupportsByName");
                    classBuilder.AppendLine("        Get");
                    classBuilder.AppendLine("          Return True");
                    classBuilder.AppendLine("        End Get");
                    classBuilder.AppendLine("      End Property");
                    classBuilder.AppendLine();
                    classBuilder.AppendFormat("      Public Sub New(parent as {0})", Strings.StrConv(this.ItemType, VbStrConv.ProperCase).Replace(" ", "")).AppendLine();
                    classBuilder.AppendLine("        _parent = parent");
                    classBuilder.AppendLine("      End Sub");
                    classBuilder.AppendLine();
                    classBuilder.AppendLine("      Public Function GetEnumerator() As System.Collections.Generic.IEnumerator(Of PropertyValueInfo) Implements System.Collections.Generic.IEnumerable(Of Gentex.Data.Base.Model.PropertyValueInfo).GetEnumerator");
                    classBuilder.AppendLine("        Dim props As New List(Of Data.Base.Model.PropertyValueInfo)");
                    itemProps.Sort((x, y) => x.VarName.CompareTo(y.VarName));
                    foreach (var prop in itemProps)
                    {
                        classBuilder.AppendLine(String.Format("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent.{0}, Nothing))", prop.VarName));
                    }
                    classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._configId, Nothing))");
                    classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._generation, Nothing))");
                    classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._isCurrent, Nothing))");
                    classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._isReleased, Nothing))");
                    classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._majorRev, Nothing))");
                    classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._minorRev, Nothing))");
                    classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._releaseDate, Nothing))");
                    classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._supersededDate, Nothing))");
                    classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._classification, Nothing))");
                    classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._createdBy, Nothing))");
                    classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._createdOn, Nothing))");
                    classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._currentState, Nothing))");
                    classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._effectiveDate, Nothing))");
                    classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._lockedBy, Nothing))");
                    classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._managedBy, Nothing))");
                    classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._modifiedBy, Nothing))");
                    classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._modifiedOn, Nothing))");
                    classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._notLockable, Nothing))");
                    classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._ownedBy, Nothing))");
                    classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._permission, Nothing))");
                    classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._state, Nothing))");
                    classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._team, Nothing))");
                    classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._id, Nothing))");
                    classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._keyedName, Nothing))");
                    classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._canDelete, New LazyLoadAttribute(True, False)))");
                    classBuilder.AppendLine("        props.Add(New Data.Base.Model.PropertyValueInfo(_parent._canUpdate, New LazyLoadAttribute(True, False)))");
                    classBuilder.AppendLine("        Return props");
                    classBuilder.AppendLine("      End Function");
                    classBuilder.AppendLine();
                    classBuilder.AppendLine("      Public Function ByName(name As String) As Base.Model.PropertyValueInfo Implements Gentex.Data.Base.Model.IModelPropertyGetter.ByName");
                    classBuilder.AppendLine("        Select Case name");
                    foreach (var prop in itemProps)
                    {
                        classBuilder.AppendLine(String.Format(@"          Case ""{0}""", prop.Name));
                        classBuilder.AppendLine(String.Format("            Return New Data.Base.Model.PropertyValueInfo(_parent.{0}, Nothing)", prop.VarName));
                    }
                    classBuilder.AppendLine("          Case Field_ConfigId");
                    classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._configId, Nothing)");
                    classBuilder.AppendLine("          Case Field_Generation");
                    classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._generation, Nothing)");
                    classBuilder.AppendLine("          Case \"is_current\"");
                    classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._isCurrent, Nothing)");
                    classBuilder.AppendLine("          Case \"is_released\"");
                    classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._isReleased, Nothing)");
                    classBuilder.AppendLine("          Case Field_MajorRev");
                    classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._majorRev, Nothing)");
                    classBuilder.AppendLine("          Case Field_MinorRev");
                    classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._minorRev, Nothing)");
                    classBuilder.AppendLine("          Case \"release_date\"");
                    classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._releaseDate, Nothing)");
                    classBuilder.AppendLine("          Case \"superseded_date\"");
                    classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._supersededDate, Nothing)");
                    classBuilder.AppendLine("          Case Field_Classification");
                    classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._classification, Nothing)");
                    classBuilder.AppendLine("          Case \"created_by_id\"");
                    classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._createdBy, Nothing)");
                    classBuilder.AppendLine("          Case \"created_on\"");
                    classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._createdOn, Nothing)");
                    classBuilder.AppendLine("          Case \"current_state\"");
                    classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._currentState, Nothing)");
                    classBuilder.AppendLine("          Case \"effective_date\"");
                    classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._effectiveDate, Nothing)");
                    classBuilder.AppendLine("          Case \"locked_by_id\"");
                    classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._lockedBy, Nothing)");
                    classBuilder.AppendLine("          Case \"managed_by_id\"");
                    classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._managedBy, Nothing)");
                    classBuilder.AppendLine("          Case \"modified_by_id\"");
                    classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._modifiedBy, Nothing)");
                    classBuilder.AppendLine("          Case \"modified_on\"");
                    classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._modifiedOn, Nothing)");
                    classBuilder.AppendLine("          Case \"not_lockable\"");
                    classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._notLockable, Nothing)");
                    classBuilder.AppendLine("          Case \"owned_by_id\"");
                    classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._ownedBy, Nothing)");
                    classBuilder.AppendLine("          Case \"permission_id\"");
                    classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._permission, Nothing)");
                    classBuilder.AppendLine("          Case Field_State");
                    classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._state, Nothing)");
                    classBuilder.AppendLine("          Case \"team_id\"");
                    classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._team, Nothing)");
                    classBuilder.AppendLine("          Case Field_PermissionCanDelete");
                    classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._canDelete, New LazyLoadAttribute(True, False))");
                    classBuilder.AppendLine("          Case Field_PermissionCanUpdate");
                    classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._canUpdate, New LazyLoadAttribute(True, False))");
                    classBuilder.AppendLine("          Case Field_Id");
                    classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._id, Nothing)");
                    classBuilder.AppendLine("          Case Field_KeyedName");
                    classBuilder.AppendLine("            Return New Data.Base.Model.PropertyValueInfo(_parent._keyedName, Nothing)");
                    classBuilder.AppendLine("          Case Else");
                    classBuilder.AppendLine("            Return Nothing");
                    classBuilder.AppendLine("        End Select");
                    classBuilder.AppendLine("      End Function");
                    classBuilder.AppendLine();
                    classBuilder.AppendLine("      Private Function GetEnumeratorCore() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator");
                    classBuilder.AppendLine("        Return GetEnumerator()");
                    classBuilder.AppendLine("      End Function");
                    classBuilder.AppendLine("    End Class");
                }

                classBuilder.AppendLine("  End Class");
            }
            classBuilder.AppendLine("End Namespace");
            return(classBuilder.ToString());
        }
예제 #11
0
            public async Task Initialize(IReadOnlyItem item, IAsyncConnection conn)
            {
                this.Label    = item.Property("label").AsString("");
                this.Name     = item.Property("name").AsString("");
                this.Required = item.Property("is_required").AsBoolean(false) ||
                                item.Property("is_class_required").AsBoolean(false);
                this.PropName = LabelToProp(this.Label);
                this.VarName  = NameToVar(this.Name);

                if (string.IsNullOrEmpty(this.PropName))
                {
                    this.PropName = LabelToProp(this.Name);
                }
                if (string.IsNullOrEmpty(this.Label))
                {
                    this.Label = Strings.StrConv(this.Name.Replace('_', ' '), VbStrConv.ProperCase);
                }

                if (item.Property("data_type").Value == "foreign")
                {
                    this.PropType = PropTypes.Foreign;
                    if (!item.Property("foreign_property").HasValue())
                    {
                        var result = await conn.ApplyAsync(@"<AML>
                                            <Item type='Property' action='get' id='@0' select='label,name,is_required,is_class_required,data_type,data_source,readonly,pattern,stored_length,foreign_property(label,name,is_required,is_class_required,data_type,data_source,readonly,pattern,stored_length)'>
                                            </Item>
                                          </AML>", true, true, item.Id()).ToTask();

                        item = result.AssertItem();
                    }
                    ForeignProp = await NewProp(item.Property("foreign_property").AsItem(), conn);

                    ForeignLinkProp = NewProp(item.Property("data_source").Value);
                }
                else if (item.Property("readonly").AsBoolean(false))
                {
                    PropType = PropTypes.ReadOnly;
                }
                else
                {
                    PropType = PropTypes.Normal;
                }

                if (this.ForeignProp != null)
                {
                    this.DataType = ForeignProp.DataType;
                }
                else
                {
                    switch (item.Property("data_type").AsString("").ToLowerInvariant())
                    {
                    case "decimal":
                    case "float":
                        DataType = "Double";
                        break;

                    case "date":
                        DataType = "Date";
                        break;

                    case "item":
                        DataType = Strings.StrConv(item.Property("data_source").KeyedName().Value, VbStrConv.ProperCase)
                                   .Replace(" ", "");
                        if (item.Property("data_source").Value == "0C8A70AE86AF49AD873F817593F893D4")
                        {
                            this.List    = item.Property("pattern").AsString("");
                            this.EbsList = true;
                        }
                        break;

                    case "integer":
                        DataType = "Integer";
                        break;

                    case "boolean":
                        DataType = "Boolean";
                        break;

                    case "list":
                    case "filter list":
                    case "mv_list":
                        DataType        = "String";
                        this.List       = item.Property("data_source").AsString("");
                        this.ListFilter = item.Property("pattern").AsString("");
                        break;

                    case "image":
                        DataType = "Gentex.Drawing.WebLazyImage";
                        break;

                    default: //"list", "string", "text"
                        this.StringLength = item.Property("stored_length").AsInt(-1);
                        this.DataType     = "String";
                        break;
                    }
                }
            }