CodeSmith Community
Your Code. Your Way. Faster!

Where are we and whats next?

Latest post 12-01-2006 8:32 AM by mcquiggd. 4 replies.
  • 11-25-2006 2:46 PM

    • swin
    • Top 10 Contributor
    • Joined on 06-14-2006
    • London, UK
    • Posts 925
    • Points 34,785

    Where are we and whats next?

    The title says it all....

    swin

    ------------------------------------------------- Member of the .NetTiers team -------------------------------------------------
    • Post Points: 35
  • 11-26-2006 4:53 AM In reply to

    • mcquiggd
    • Top 25 Contributor
    • Joined on 07-11-2006
    • Amsterdam
    • Posts 174
    • Points 4,375

    Re: Where are we and whats next?

     

    Well, for the future, I would say:

    1) The option to support LinQ is pretty high on the list....I am working on that myself. The ideal is that we should be able to work with the mapping meta data generated by SqlMetal or a GUI Designer, in the same way we do with meta data from the SqlSchemaProvider in Codesmith - basically have a LinqSchemaProvider that is as close as a drop in replacement to the Sql version as possible so the current templates do not require major reworking, and gradually add to / alter the templates to implement LinQ for Databases and LinQ for Entities within the framework.

    For those who might be interested, while looking into this I came across an alternative AssemblySchemaExplorer written for Codesmith 2.6 that was an attempt to use Classes identified by reflection as the starting point for Code Generation rather than the SqlSchemaProvider. http://www.ridgway.co.za/eden/PermaLink,guid,2ff12f1d-1b8b-4807-b6f2-dcfd9e56b1bc.aspx. I'll post later in more detail as to how this might be useful, but heres a hint...

    If you use the LinqDesigner in the May CTP, it generates a Class that contains attributes such as:

    [System.Data.DLinq.Column(Name="CompanyName", Storage="_CompanyName", DBType="nvarchar NOT NULL")]

    [System.Data.DLinq.Association(Name="FK_Orders_Customers", Storage="_Customer", ThisKey="CustomerID", IsParent=true)]

    Some time earlier this year I wrote a demo that used reflection to look at Attributes that had been attached to Properties of a class, that was then output to an XML file, that described column types, names etc, and any relationships between them. http://community.codesmithtools.com/forums/permalink/16042/16042/ShowThread.aspx#16042

     The syntax for these Attributes was:

    [PropertyMetaData(false, "", 0, 0, 0, false)]
    [
    RelationshipMetaData("FK_OrdersToCustomers", "", "Customers", "CustomerID")]
    public int CustomerID
    {
     
    get { return _customerID; }
     
    set { _customerID = value; }
    }

    The Xml file was used to create a Database using a basic Codesmith Template, then .NetTiers was used to generate on that database to add the 'plumbing' to the concrete classes that had already been created with the Custom Attributes.

    Potentially, using a Reflection based SchemaProvider would bypass all this: Design your classes in the LinQ Designer (perhaps based on an existing Database, perhaps constructed 'Ghost Tables'), add Relationships, and build the project. Open Codesmith, select the .NetTiers template and specify the SchemaProvider as LinQReflectionSchemaProvider. Open the dll created by the LinQ project, and the LinQReflectionSchemaProvider allows you to select Linq Entities (C.F Tables) to generate against, including relationship MetaData etc - but this does not currently include Index meta data..... it might be possible to extract this by using Linq itself within the SchemaProvider, but SQLMetal does include Index data - apparently the two approaches are merging to support a standard Schema definition.

    However, it does allow for Inheritence modelling in meta data terms (a possible enhancement to .NetTiers..?), the creation of what I referred to earlier as 'Ghost Tables', and does support Views.

    Used in conjunction with an XML file generated by SQLMetal, which would allow overrides (e.g. more complex persistance of an object to multiple tables, and you have a pretty flexible, and largely Graphical, way to design and build a Data Domain that is then used to create the .NetTiers architecture...

    In would seem, if MS delivers with LinQ, we can:

    • Take an existing Database, graphically design the Domain we wish to achieve, add 'ghost tables' to represent Entities, declare relationships - as if we were designing a Class Hierarchy.
    • Without a Database, graphically design the Domain we wish to achieve, add 'ghost tables' to represent Entities, declare relationships - as if we were designing a Class Hierarchy.
    • Generate a .NetTiers architecture whichever approach is taken.

    The more flexible Codesmith is in giving us multiple approaches to obtaining metadata the better.

    Another project that is of interest is BLinq : http://www.asp.net/sandbox/app_blinq.aspx?tabid=62

    2) Lightweight Entities that are effectively created from the output of Custom Stored Procedures, as per the 'Ghost Tables' concept mentioned earlier. I dont really want to have unneccessary Views added to the Database just to create an Entity that does not have a direct one-to-one table mapping. There should be sufficient meta data there from stored procedures to generate the basic Properties and some Validation Rules, without looking for Indexes, Relationships etc. CSP's would retrieve data from multiple tables and handle any updates.

    3) For Web - only projects, make generation of the events and Interface implementations that are really only of interest to WinForms apps an option. This would reduce the amount of code quite substantially, I think...

    4) Examples of using different physical architectures... out of the box, the code generated is suitable for installing on a single web server or multiple servers (i.e. Web Farm), but not the common web server > application server > database server (at least for the Domain model). Id love to see example applications that include Remoting, Message Queuing, WCF used as inter-tier transports....

    5) Keep on the good work with the Strongly Typed UI controls - the DataSources and Repeater, for example. I demoed how to generate against an exisiting db to a colleague, and by the time I showed him the Admin screens, and how simple it was to include a Datasource with syntax completion for Paramaters, Deep Load Types etc, he asked me stop, as he was blown away with how much time it would have saved him compared to having written the application from scratch, as he used to do. Big Smile

    6) PLEASE, add a 'Refresh Schema' button to the CodeSmith interface - just a small point but its annoying to have to manually refresh the Schema by desecting / reselecting tables etc when debugging generated code / altering the Database during development....

     

    Oh, and can we have the number of 'Views' each topic has had back please? It would be nice to know if anyone is reading this Wink

    David (Could people PLEASE click the 'Mark As Answer' button on the message that solved their problems - it will help others with similar questions and could potentially be included in an FAQ to save time for all of us)
    • Post Points: 65
  • 11-27-2006 2:58 AM In reply to

    • swin
    • Top 10 Contributor
    • Joined on 06-14-2006
    • London, UK
    • Posts 925
    • Points 34,785

    Re: Where are we and whats next?

    Hi David,

    Some interesting stuff there!

    I'd say.....

    1. LinQ - Definately should be near the top of the list.  Not sure about your BlinQ link - isn't that just an alternative to NT?

    2. Lightweight entities - yes, this would certainly be a big benefit in my eyes.

    3. What "events and intefaces" are you refering to?

    4. More examples and better documentation all round.  Theres so many great things about NetTiers but finding out what they are and how to use them can be frustrating (even after using it for a while) and the number of newbie questions revolving around same sort of subjects suggests that more guidance is needed.  I'm willing to help in this area (with my limited knowledge and time!) - perhaps the wiki could be opened up and advertised more?

    5. Yes, I really like the strongly typed controls too. They make putting together some pages a cinch.  I haven't had a chance to check out the CAB based modules yet but I like the sound of them.

    6. Yes, there are various "annoyances" with Codesmith that sometimes make it a pain regening (maybe some have been addressed in the new version (i've yet to check).  Although saying that, my whole build process could be improved Confused (currently stuck with using vss - which is not nice!)

    (7) Yes, having "view count" back on this site would be good.

    ..and my thoughts...

    8. Improve performance of some operations - eg "DeepLoading" objects (so that not so many round trips to the db are required) -  Maybe auto generated sp's to populate entities with any FK relationships in one db hit.

    9. Better documentation.  I know I've already mentioned it above, but certainly I think it is a stumbling block for some who don't have the time to figure out for themselves how features in NT work or how to structure a project.

    10. Spread the word! NT is good! no, very good! more people should know about it!

    Cheers

    swin

    ------------------------------------------------- Member of the .NetTiers team -------------------------------------------------
    • Post Points: 5
  • 11-28-2006 3:09 AM In reply to

    • calvero
    • Not Ranked
    • Joined on 09-10-2003
    • Atlanta, GA
    • Posts 4
    • Points 80

    Re: Where are we and whats next?

    mcquiggd:

     2) Lightweight Entities that are effectively created from the output of Custom Stored Procedures, as per the 'Ghost Tables' concept mentioned earlier. I dont really want to have unneccessary Views added to the Database just to create an Entity that does not have a direct one-to-one table mapping. There should be sufficient meta data there from stored procedures to generate the basic Properties and some Validation Rules, without looking for Indexes, Relationships etc. CSP's would retrieve data from multiple tables and handle any updates.

    Working with the NetTiers framework, I highly desired this feature myself.  Perhaps some discussion here could inspire me to write it.  By ghost tables, do you mean a dynamically code created table that something like a DataReader would fill upon stored procedure execution?  Also, what type of validation would a CSP object need?  Basically, ensuring that the incoming parameters are set before execution?  Also, I could see only supporting SELECT CSPs, you wouldn't be able to create, update or delete objects using similarly structured CSPs.

    If there is anyone out there that could help walk me through fitting this into the NetTiers framework from a high-level, I wouldn't mind taking a swing at implementing. 

    Jason 

    • Post Points: 35
  • 12-01-2006 8:32 AM In reply to

    • mcquiggd
    • Top 25 Contributor
    • Joined on 07-11-2006
    • Amsterdam
    • Posts 174
    • Points 4,375

    Re: Where are we and whats next?

    P.S : Inheritence. Not that I particularly want to use it heavily, but in certain cases it is useful.
    David (Could people PLEASE click the 'Mark As Answer' button on the message that solved their problems - it will help others with similar questions and could potentially be included in an FAQ to save time for all of us)
    • Post Points: 5
Page 1 of 1 (5 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems