Exemplo n.º 1
0
        internal void Generating(ITableReader tableReader, IClassWriter classWriter)
        {
            tableReader.Close();
            classWriter.ClearProperty();

            string className = FileMedia.QUERY_CLASS_PRE + Misc.GetPublicName(tableReader.TableName);

            classWriter.ClassName = className;

            if (string.IsNullOrEmpty(classWriter.NameSpace))
            {
                classWriter.NameSpace = _nameSpace;
            }

            try
            {
                tableReader.Open();

                while (tableReader.Read())
                {
                    TableColumn tableColumn  = tableReader.CurrentColumn().Value;
                    string      propertyName = Misc.GetPublicName(tableColumn.Name);
                    classWriter.AppendProperty(propertyName, tableColumn, tableColumn.DotNetType);
                }

                classWriter.WriteOut();
            }
            finally
            {
                tableReader.Close();
            }
        }
Exemplo n.º 2
0
 internal Weaver(
     ISchemaReader importAdapter,
     IClassWriter exportAdapter)
 {
     SchemaReader = importAdapter;
     Writer       = exportAdapter;
 }
Exemplo n.º 3
0
        public void Generating(ITableReader tableReader, IClassWriter classWriter, IClassLogicWriter classLogicWriter, IMapWriter mapWriter)
        {
            tableReader.Close();
            classWriter.ClearProperty();
            mapWriter.ClearItem();

            if (classLogicWriter != null)
            {
                classLogicWriter.ClearProperty();
            }

            string className = FileMedia.ENTITY_CLASS_PRE + Misc.GetPublicName(tableReader.TableName);

            classWriter.NameSpace = _nameSpace;
            classWriter.ClassName = className;

            if (classLogicWriter != null)
            {
                classLogicWriter.ClassNameSpace      = _nameSpace;
                classLogicWriter.ClassName           = className;
                classLogicWriter.ClassLogicNameSpace = _logicNameSpace;
                classLogicWriter.ClassLogicName      = className + "Helper";
            }

            mapWriter.ClassName    = string.Format("{0}.{1}", _nameSpace, className);
            mapWriter.AssemblyName = _assemblyName;
            mapWriter.TableName    = tableReader.TableName;

            try
            {
                tableReader.Open();

                while (tableReader.Read())
                {
                    TableColumn tableColumn  = tableReader.CurrentColumn().Value;
                    string      propertyName = Misc.GetPublicName(tableColumn.Name);
                    classWriter.AppendProperty(propertyName, tableColumn, tableColumn.DotNetType);

                    if (classLogicWriter != null)
                    {
                        classLogicWriter.AppendProperty(propertyName, tableColumn.DotNetType, tableColumn.IsKey);
                    }

                    mapWriter.AppendItem(new MapItem(propertyName, tableColumn.Name, tableColumn.DatabaseType, tableColumn.IsKey, tableColumn.CanBeNull, tableColumn.MaxLength, true, true));
                }

                classWriter.WriteOut();

                if (classLogicWriter != null)
                {
                    classLogicWriter.WriteOut();
                }

                mapWriter.WriteOut();
            }
            finally
            {
                tableReader.Close();
            }
        }
 public static IWeaver Create(
     ISchemaReader importAdapter,
     IClassWriter exportAdapter) =>
 new Weaver(importAdapter, exportAdapter);
Exemplo n.º 5
0
 public Xml2CodeConverter(IClassWriter writer)
 {
     _writer = writer;
 }