Ejemplo n.º 1
0
        public void WriteContract(DataBaseTable item)
        {
            var path = Path.Combine(Config.CSharp.Repository.Contract.Path, item.Schema);
            var file = $"I{item.Name}Business.cs";

            var nameSpace = new List <string> {
                "System", "XCommon.Patterns.Repository"
            };

            nameSpace.Add($"{Config.CSharp.Entity.NameSpace}.{item.Schema}");
            nameSpace.Add($"{Config.CSharp.Entity.NameSpace}.{item.Schema}.Filter");

            var builder     = new StringBuilderIndented();
            var parentClass = $"IRepositoryEF<{item.Name}Entity, {item.Name}Filter>";
            var appClass    = Config.CSharp.ApplicationClasses.FirstOrDefault(c => c.Name == item.Name && c.Schema == item.Schema);

            if (Config.CSharp.UsingApplicationBase && appClass != null)
            {
                parentClass = $"{appClass.NamespaceContract}.I{item.Name}Business";
                nameSpace   = new List <string>();
            }

            builder
            .InterfaceInit($"I{item.Name}Business", parentClass, $"{Config.CSharp.Repository.Contract.NameSpace}.{item.Schema}", ClassVisibility.Public, nameSpace.ToArray())
            .InterfaceEnd();

            Writer.WriteFile(path, file, builder, false);
        }
Ejemplo n.º 2
0
        public void WriteContract(DataBaseTable item)
        {
            var path = Path.Combine(Config.CSharp.Repository.Contract.Path, item.Schema);
            var file = $"I{item.Name}Business.cs";

            var nameSpace = new List <string> {
                "System", "XCommon.Patterns.Repository"
            };

            nameSpace.Add($"{Config.CSharp.Entity.NameSpace}.{item.Schema}");
            nameSpace.Add($"{Config.CSharp.Entity.NameSpace}.{item.Schema}.Filter");

            var builder = new StringBuilderIndented();

            builder
            .InterfaceInit($"I{item.Name}Business", $"IRepositoryEF<{item.Name}Entity, {item.Name}Filter>", $"{Config.CSharp.Repository.Contract.NameSpace}.{item.Schema}", ClassVisility.Public, nameSpace.ToArray())
            .InterfaceEnd();

            Writer.WriteFile(path, file, builder, false);
        }
Ejemplo n.º 3
0
 internal static StringBuilderIndented InterfaceInit(this StringBuilderIndented builder, string interfaceName, string parent, string nameSpace, ClassVisility visibily, params string[] usings)
 {
     return(builder
            .InterfaceInit(interfaceName, parent, nameSpace, visibily, false, usings));
 }