Coder Social home page Coder Social logo

Comments (4)

stuarta0 avatar stuarta0 commented on July 19, 2024

Further thoughts on this: get rid of SQL entirely. Simplify IConfiguration by removing matrix, remove SourceSQL from ISubject and rename SourceName on IField to Key (we still want to look up fields based on a key that isn't the display name).

Now we can have concrete implementations like MatrixConfiguration which uses the matrix SQL concept, RelationConfiguration which uses RelationSubject with the Dictionary<RelationSubject, FieldPath[]> logic. We could possibly go as far as NHibernateConfiguration which has ISubject and IField of Class and Property respectively.

If we still want SQL, we can have an ISqlSubject : ISubject which defines the SourceSQL property. If we want to combine the IRelationSubject : ISubject with the SQL behaviour, we can roll a RelationSqlSubject : ISqlSubject, IRelationSubject.

From this point we now have options. The SqlGenerator would move out of the core library as would ISqlSubject etc. into something like dbqf.Sql. The SqlGenerator would work with the ISqlSubject logic, so if you wanted to do querying via some other means you don't have to include this library. For the existing Standalone applications we'd make a factory (or something) that provided a way of getting results (keeping in mind this might not just be a DataTable - it might be real POCOs) by taking an IParameter. Then in our IoC bootstrapping we can swap behaviour as to how configurations are constructed and how results are retrieved!!

from dbqf.

stuarta0 avatar stuarta0 commented on July 19, 2024

A note on NHibernate. If we do the above logic we'd implement our own NH ParameterBuilders too. These would all return the same concrete NHParameter : IParameter which has an ICriteria property. The ParameterBuilders can then construct a whole ICriteria graph by doing something like:

EqualsBuilder.Build(NHField f, object[] values)
{
  return new CriteriaParameter()
  {
    Criteria = Criterion.Eq(f.Property, values)
  };
}

Then we can use these with a query factory that uses NHibernate sessions (instead of the SqlGenerator logic), something like:

public DataSource GetResults(IParameter p)
{
  // if you're an NH dev I give you my apologies for complete 
  // lack of knowledge in the API, but you get the gist
  _session.Get<T>(((CriteriaParameter)p).Criteria);
}

from dbqf.

stuarta0 avatar stuarta0 commented on July 19, 2024

Initial refactor of SQL library committed to ee4102e

from dbqf.

stuarta0 avatar stuarta0 commented on July 19, 2024

dbqf.core only contains IConfiguration and dbqf.Sql contains IMatrixConfiguration. The Standalone application still relies on IMatrixConfiguration but this can be further broken down at another time. SqlString behaviour in criterion was also pulled out of core in the recent backend refactor. Until the other configuration types are implemented, this feature can be considered complete.

from dbqf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.