CodeSmith Community
Your Code. Your Way. Faster!

NetTiers2 CTP Configuration

Latest post 03-02-2006 11:39 AM by rodrigo.c.souza. 12 replies.
  • 01-16-2006 2:45 PM

    • jcteague
    • Top 10 Contributor
    • Joined on 03-10-2005
    • Austin, Tx
    • Posts 442
    • Points 10,925

    NetTiers2 CTP Configuration

    There have been a lot of posts about problems with the CTP that are Configuration related.

    In the CTP the configuration is MUCH easier.  It is much shorter and does not require the Enterprise Library Configuration tool.

    So for starters do not use the Enterprise Library Config tool.  It does not generate what you need.  The configuration needed is as follows.  You will need to adjust some of the parameters for your particular application of course.

    <configSections>

    <section name="netTiersService" type="[Your DataAccessLayer].Bases.NetTiersServiceSection, [Your Namespac.DataAccessLayer" allowDefinition="MachineToApplication" restartOnExternalChanges="true"/>

    </configSections>

    <netTiersService defaultProvider="SqlNetTiersProvider">

    <providers>

    <!--

    *** SqlClient Provider ***

    connectionStringName: sqlclient connection string to the db
    useStoredProcedure: if truei ndicates that we use the stored procedures, otherwise, we use parametrized queries that are embedded.

    -->

    <add name="SqlNetTiersProvider"
    type="[Your Namespace].SqlClient.SqlNetTiersProvider, Northwind.[Your Namespace]SqlClient" connectionStringName="[Configuration Connection String Name]"
    useStoredProcedure="true"
    providerInvariantName="System.Data.SqlClient"/>

    <!--
    *** WebserviceClient Provider ***
    The url parameter indicates the webservices url (ex: http://localhost/NorthWind/NorthWindServices.aspx)
    <add name="WsNetTiersProvider"
    type="Northwind.DataAccessLayer.WebServiceClient.WsNetTiersProvider, Northwind.DataAccessLayer.WebServiceClient" url="NorthwindServices.asmx"/>
    -->
    </providers>
    </
    netTiersService>
    <
    appSettings/>

    So you just need to reference the correct namespaces to your generated code and your set.  The connectionStringName is the name of a connectionstring you've added.

    <connectionStrings>
    <
    add name="myDbConnection" connectionString="..." providerName="System.Data.SqlClient"/>
    </
    connectionStrings>

    Hope this helps, John

    Thanks, John Teague ------------------------------ Member of the .NetTiers team http://www.nettiers.com ------------------------------

    • Post Points: 95
  • 01-16-2006 3:09 PM In reply to

    Re: NetTiers2 CTP Configuration

    Hi John,

    These are not the problems that I and some of the other recent posts are experiencing, I have the layers working and accessing data it is just when used without code (with an ObjectDataSource set to the xxxprovider bit).

    Can you try and drop a gridview on a form, select new datasource from the smart tag and setup an object datasource to link to the classes generated by nettiers? You'll then see what I mean, this should run 'out of the box' but does not because for some reason 'Initialize' is not getting called in the provider.

    But another page in the same site with code based retrieval (xxx.GetAll) works fine.

    Ryan
    • Post Points: 35
  • 01-16-2006 3:27 PM In reply to

    • jcteague
    • Top 10 Contributor
    • Joined on 03-10-2005
    • Austin, Tx
    • Posts 442
    • Points 10,925

    Re: NetTiers2 CTP Configuration

    I replied to your original posts.  Let me know if those solutions don't work. 

    Thanks, John Teague ------------------------------ Member of the .NetTiers team http://www.nettiers.com ------------------------------

    • Post Points: 5
  • 01-25-2006 9:30 PM In reply to

    • sdavison
    • Top 150 Contributor
    • Joined on 01-25-2006
    • Posts 26
    • Points 805

    Re: NetTiers2 CTP Configuration

    Sorry in advance for my ignorance but I've tried all day to get this working just so I can play around with the results of the wrappers.  Unfortunately, I can't even get the configuration correct, as it always errors out setting up the providers.  I've written a simple C# windows application to use the .NetTiers classes, which I generated using the CTP build using the Northwind database.  As suggested above, I didn't use the Enterprise Library Configuration tool to open the app.config but rather hand-edited it as close as I could figure from your post.  Here is the contents of my app.config:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <configSections>
        <section name="netTiersService" type="Northwind.DAL.Bases.NetTiersServiceSection, Northwind.DAL" allowDefinition="MachineToApplication" restartOnExternalChanges="true"/>
      </configSections>
      <netTiersService defaultProvider="SqlNetTiersProvider">
        <providers>
          <add name="SqlNetTiersProvider"
          type="Northwind.DAL.SqlClient.SqlNetTiersProvider, Northwind.DAL.SqlClient" connectionStringName="NWind"
          useStoredProcedure="true"
          providerInvariantName="System.Data.SqlClient"/>
        </providers>
      </netTiersService>
      <connectionStrings>
        <add name="NWind" connectionString="Data Source=192.168.0.1;Integrated Security=False;User ID=joeuser;Password=somepassword;Initial Catalog=Northwind;" providerName="System.Data.SqlClient"/>
      </connectionStrings>
    </configuration>


    The error that pops up is always in Northwind.DAL.DataRepository on this line:

    ProvidersHelper.InstantiateProviders(section.Providers, _providers, typeof(NetTiersProvider));

    The contents of the error is "Could not load file or assembly 'Northwind.DAL.SqlClient' or one of its dependencies. The system cannot find the file specified. (C:\NetTiers\Northwind\Northwind\bin\Debug\Northwind.vshost.exe.config line 9)"

    Do I have something out of place or am I just missing something really dumb here?  Thanks for any help!
    • Post Points: 35
  • 01-26-2006 8:45 AM In reply to

    • jcteague
    • Top 10 Contributor
    • Joined on 03-10-2005
    • Austin, Tx
    • Posts 442
    • Points 10,925

    Re: NetTiers2 CTP Configuration

    It looks correct to me.  I'm not a windows developer, but I can't imaging it would be that different from a web configuration.  My only suggestion at this point is to double check that you have all of the references in place and the dll does exist.

    Sorry I'm not much help.  Hopefully somone with more 2.0 experience can answer.

    Thanks, John Teague ------------------------------ Member of the .NetTiers team http://www.nettiers.com ------------------------------

    • Post Points: 35
  • 01-26-2006 9:53 AM In reply to

    Re: NetTiers2 CTP Configuration

    Hi

    If the build process worked without failing/errors have you tried running the nUnit tests? The reason I ask is that if you've managed to build ok, and the tests run ok then you can just do a straight copy and paste from the config file that's in the 'UnitTests' project - that's what I've been doing and it means there's no manual editing that you have to do.

    Hope that helps

    Martin

    • Post Points: 5
  • 02-05-2006 4:15 PM In reply to

    Re: NetTiers2 CTP Configuration

    Hi,

    When you see that error - try including the SQLClient project and adding a reference to this project in the web project or whichever one needs to access the DB. I (like others) had thought I only needed the DAL and BLL projects :) - turns out there's another one that needs to be added.

    My goal was to intercept the connection string and set it at runtime and so I starting trying to insert a connection string into the web.config file ... turns out that all this time I could have done it inside this SqlClient project... finally! Now I'm off to the races...

    The specific place: _connectionString = WebConfigurationManager.ConnectionStrings...

    inside of Initialize( ) in the SqlNetTiersProvider.cs file - only problem is that a regen clears any code changes there! And I don't want to place the code in all of the other provider files (which presumably don't get cleared since there is also a provider.generated file for each one). It would be nice if there was one for this file too... hint hint guys :)

    I should mention that I'm using the latest CTP I could find -- near Feb 1, 2006, and VS 2005, so a lot of the configuration setup is improved.

     

    Clynton
    -------------------------------------
    Member of the .NetTiers team
    http://www.nettiers.com
    -------------------------------------
    • Post Points: 60
  • 02-11-2006 1:59 AM In reply to

    Re: NetTiers2 CTP Configuration

    Before I found this post, I had been trying the EntLib tool, and getting an error about a type initializer throwing an exception. After reading this post, I built an app.config for my WinForm application following the instructions above. Now when starting the application under the VS 2005 debugger, I'm getting the following error thrown by the DAL.Configuration private constructor: (using the 2/10/06 NetTiers CTP Nightly build)

    Invalid section name. The section 'netTiersConfigData' does not exist in the requested configuration file 'C:\Mydocs\Visual Studio 2005\Projects\TeaLeaf\Applications\TMCM\Library\BS_Build\bin\Debug\BS_Build.vshost.exe.config' or the file 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\machine.config'. Make sure that the 'enterpriseLibrary.configurationSections' configuration section exists in one of the files and that the section 'netTiersConfigData' is defined.

    Sure looks like it is still expecting something from the EntLib config tool. I deleted all .config files from my bin/Debug subdir, and made sure the only .config files there followed the format above. Here's my current app.config, any pointers would be much appreciated.

    <configuration>

    <configSections>

    <section name="netTiersService" type="TeaLeaf.Applications.TMCM.DataAccessLayer.Bases.NetTiersServiceSection, TeaLeaf.Applications.TMCM.DataAccessLayer" allowDefinition="MachineToApplication" restartOnExternalChanges="true"/>

    </configSections>

    <connectionStrings>

    <add name="TeaLeaf.Applications.TMCM.Properties.Settings.TMCM_Model_DevelopmentConnectionString" connectionString="Data Source=localhost;Initial Catalog=TMCM_Model_Development;Integrated Security=True;" providerName="System.Data.SqlClient" />

    </connectionStrings>

    <netTiersService defaultProvider="SqlNetTiersProvider">

    <providers>

    <add name="SqlNetTiersProvider"

    type="TeaLeaf.Applications.TMCM.SqlClient.SqlNetTiersProvider, TeaLeaf.Applications.TMCMSqlClient" connectionStringName="TeaLeaf.Applications.TMCM.Properties.Settings.TMCM_Model_DevelopmentConnectionString"

    useStoredProcedure="true"

    providerInvariantName="System.Data.SqlClient"/>

    </providers>

    </netTiersService>

    </configuration>

     

    • Post Points: 35
  • 02-11-2006 9:59 AM In reply to

    Re: NetTiers2 CTP Configuration

    Hi, The reason you're getting this error, is because this is strictly for the NetTiers2 configuration.  It seems as though you're still using NetTiers (Caribert).

    Which version of enterprise library are you using, and are you using VS2003 or VS2005?


    Robert Hinojosa
    -------------------------------------
    Member of the Codesmith Tools, .netTiers, teams
    http://www.nettiers.com
    -------------------------------------
    • Post Points: 65
  • 02-12-2006 10:18 PM In reply to

    • rburkhal
    • Top 200 Contributor
    • Joined on 02-01-2006
    • Posts 23
    • Points 480

    Re: NetTiers2 CTP Configuration

    Ok,
        This is a good one,

        1)  The below web.config is what I'm using to access my objects
        2)  All compilation is successfull
        3)  Sample aspx doesn't retreive any records
        4)  netTiersConnectionString appears on the asp.net console without me adding. 
        5) It won't be deleted, places a remove in the web.config and strike-through's the text in asp.net tab
        6) It places the wrong connectstring by default
        7) Is this a new feature that I haven't seen posted?
        8) I can delete the web.config and the netTiersConnectionString is still there, in the asp.net tab in IIS.
        9) useStoredProcedure="true",  when this is set to true I get an error
           a) The entry 'SqlNetTiersProvider' has already been added. (c:\inetpub\wwwroot\fr\web.config line 8)
            b) Remove that section and run again click the control and still no data, but no error.
           c) Where is the config information comming from now! So now I can't set provider to use stored procedures.

        10) Has anyone else had the same problem
        11) This is a CTP latest build
        12) NUnit Test all succed
        13) I'm lost....Help.
        14) Download the example Northwind Web app and set it up ,
              a) It returned records fine
              b) When the app ran it launced in it's own web server in VS2005
              c) No records returned when I run my sample on the Local IIS server.
              d) Will test adding the sample Northwind app to the local IIS server.
                  i) Completed that test with the same results on IIS server, Northwind app responed the same way
              e) Will test my app running from VS2005 web server
                 i) Test returned no records, and still dont know why the Northwind sample works and mine doesn't.
        15) Found answers to the auto adding of nettiers config, it was in global setting of site, don't know how it got there.
       16) Resolved Issue of Data not showing up
                A)  Needed to assign a theme and skin
                      i) This needs to be documented with the samples, which came with nothing but code.
       17) My sample app works fine but there are issues when the app is deployed to an IIS machine(localhost).
             1)  Parser Error Message: Missing connection string
                      Source Error:

                Line 13:       <add
                Line 14: name="SqlNetTiersProvider"
                Line 15: type="NCC.FR.DataAccessLayer.SqlClient.SqlNetTiersProvider, NCC.FR.DataAccessLayer.SqlClient"
                Line 16: connectionStringName="netTiersConnectionString"
                Line 17: useStoredProcedure="true"

       18) The above error was from me finding the same web.conf in the root folder, and removing all items in it.  Then I had removed as it said the connection string.  Removed the web.config, replaced with the VS2005 working version and Bam, Works fine.  Issue Closed.
       19)  The No-Records  problem was from  NetTiers not generating a  skin file for the project, I'm not sure if this is suppose to be the case....But NOTE: Your project will not work until u define a skin file for the page using the controls.


    //// Current web.Config
        <configSections>
            <section name="netTiersService" type="NCC.FR.DataAccessLayer.Bases.NetTiersServiceSection, NCC.FR.DataAccessLayer" allowDefinition="MachineToApplication" restartOnExternalChanges="true"/>
        </configSections>
        <netTiersService defaultProvider="SqlNetTiersProvider">
            <providers>
                <add name="SqlNetTiersProvider" type="NCC.FR.DataAccessLayer.SqlClient.SqlNetTiersProvider, NCC.FR.DataAccessLayer.SqlClient" connectionStringName="netTiersConnectionString" useStoredProcedure="true" applicationName="LMS2WebApp" providerInvariantName="System.Data.SqlClient"/>
            </providers>
        </netTiersService>


    ////  Modified web.Config
        <configSections>
            <section name="netTiersService" type="NCC.FR.DataAccessLayer.Bases.NetTiersServiceSection, NCC.FR.DataAccessLayer" allowDefinition="MachineToApplication" restartOnExternalChanges="true"/>
        </configSections>

    ////  Added by IIS through asp.net tab
      <connectionStrings>
        <remove name="netTiersConnectionString" />
        <add name="netTiersConnectionString" connectionString="server=1x.x.0.xxx\Ncc;database=NatSQL;Integrated Security=false;user=xxx;pwd=xxxxx;Connection Timeout=20;" />
      </connectionStrings>


    • Post Points: 35
  • 02-13-2006 3:37 AM In reply to

    Re: NetTiers2 CTP Configuration

    Hi,

    Sorting through your message am I right in thinking that your .NetTiers code is working fine, but you are having problems with your apps in that they will run on the VS2005 webserver, but won't with IIS installed locally.

    My gut reaction says that it is probably a permissions issue, but without further details of the actual error message it is difficult to tell.

    HTH
    cheers, Julian
    • Post Points: 5
  • 02-14-2006 12:30 AM In reply to

    Re: NetTiers2 CTP Configuration

    Thanks for your reply. I had installed the 0.9.2 version and been working with it, then downloaded the CTP version for 1.0. I didn't realize I had forgotton to uninstall 0.9.2. That, followed by a cut'n'paste of the app.config generated by the nUnit test, solved the problem.

    Happy to report that i also succeeded in generating my first datagridiew view bound to a TList class generetd by Net Tiers for one of my DB tables. Will post how I did it later this week, since it seems others have been having the same problem.

    • Post Points: 35
  • 03-02-2006 11:39 AM In reply to

    Re: NetTiers2 CTP Configuration

    Why don´t you just use the template called App.config.2005.cst under NetTiers2\DataAccessLayer in CodeSmith? Is just simple and works.

    ;-)

    Rodrigo C. Souza

     

    • Post Points: 5
Page 1 of 1 (13 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems