samedi 29 avril 2017

Design to store query in object form

We are building an application where we need to store Query in object form like:

    class Query{
     public Select s{get;set;}
     public From f{get;set;}
    }
    class select {
     public List< Column > columns {get;set;}

    }
    class Column{
     public string ColumnName {get;set;}
     public string AliasName {get;set;}
    }
    class From {
     public Table mainTable{get;set;}
     public List<JoinTable>{get;set;}
    }
    class Table {
     public string tableName{get;set;}
     public string Alias{get;set;}
    }
    class JoinTable:Table{
     public string OnExpression{get;set;}
    }

we are storing details in these objects so later on we can create queries for any database using these objects.It can be even more complex with subquery also. Please let me know if there is any better design to do so.

Note: We are using C# to develop this application.

Aucun commentaire:

Enregistrer un commentaire