.netTiers
Help Wanted! If you are using .netTiers and find it as invaluable as we do, please consider giving back to the .netTiers team by helping with our effort to fully document .netTiers. To help, simply create an account and you will then be able to edit this wiki.

Table of Contents [Hide/Show]


Frequently Asked Questions
   General .netTiers
      What do I need to get started with .netTiers?
      Where do I download the latest .netTiers templates?
      What database platforms does .netTiers support?
      What about using .netTiers with VB.NET?
      How fast is .netTiers compared with other code generators/Object-Relational Mappers?
      Who is .netTiers for?
   Code Generation
      How can I refresh my Database schema cache?
   Entity Layer
      How much deep-loading functionality does .netTier generate?
   Data Layer
      I set the NetTiersProvider.DefaultCommandTimeout property, so why does my (slow) Sproc time out using the SQL provider?
      Question
      How can I get a count of the Total Items in a table?
      GetPaged doesn't return the correct page
   Component Layer
      How does the DomainModel component layer implementation work?
      How does the ServiceModel component layer implementation work?
      Why don't some data access methods (such as Find) show up when I attempt to bind a data source to a service object?
   Web Layer
      What is the Web Library?
      Question
   WinForms Layer
      What is the WinForms library?
      Question
   Unit Tests Layer
      Question
   Web Services Layer
      What is the WebServiceClient Layer? Why not just call the WebService directly?
      Question
   WCF Layer
      Question
      Question
   Data Grids and Related Tables
      How do I display related data in my ASP.net GridView?
      How do I display related data in my winforms GridView?
   Security
      How to use Security Application Block with NetTiers


Edit

Frequently Asked Questions

Edit

General .netTiers

Edit

What do I need to get started with .netTiers?

You'll need to install CodeSmith, and you can get a free eval copy from the CodeSmith website. Then you'll need to download the .netTiers templates. Once you've done that go to the Getting Started section of this wiki for step by step instructions.

Edit

Where do I download the latest .netTiers templates?

You can find the latest copy of the code at Nightly Downloads Edit

What database platforms does .netTiers support?

Currently .netTiers supports Sql Server 2000, Sql Server 2005, Sql Server Express, Sql Server 2008, & Oracle. Several other database providers like SqlLite and Firebird have limited support with the available Generic Client.

Edit

What about using .netTiers with VB.NET?

It can be done! .netTiers generates C#, but the assemblies are CLS-compliant. This means that you can build a system from any combination of .NET languages and things generally work the way you expect. There are some VB Gotchas though, so make sure you read up before you consider mixing VB.NET with .netTiers.

Edit

How fast is .netTiers compared with other code generators/Object-Relational Mappers?

Edit

Who is .netTiers for?

.netTiers is a tool ideally suited for developers that have a good idea about database schema design and C# development patterns and practices. It also helps if the developer knows a bit about Code Smith since that is the tool used to generate the .NetTiers. Because .netTiers is not a commercial tool there are some rough edges, these are being worked on to constantly improve the development process as such, it would be helpful to have a strong senior architect \ developer on the team to keep the structure secure while working out any kinks.

Edit

Code Generation

Edit

How can I refresh my Database schema cache?

If CodeSmith isn't recognizing the changes in your database schema, try clicking the ... button of the SourceTables or SourceDatabase properties from your property set. Alternatively, you can close and re-open CodeSmith. UPDATE: In CodeSmith 4.1+, there is a refresh schema button on the property grid toolbar.

Edit

Entity Layer

Edit

How much deep-loading functionality does .netTier generate?

It is possible to deep load an object graph that represents a set of related tables. The API contains several deep-load options that offer control over recursion, parent/child inclusion, exactly which entity types (tables) should be included.

Deep-load works the best when loading related data that has a tree-like structure. Deep-load will attempt to handle recursive or circular relationships, but depending on the circumstances, these structures may limit the effectiveness of deep-load.

Edit

Data Layer

Edit

I set the NetTiersProvider.DefaultCommandTimeout property, so why does my (slow) Sproc time out using the SQL provider?


Contrary to what you might think, the family of Execute* functions in Data.Bases.NetTiersProvider.ProviderBase as implemented by SqlNetTiersProvider, does not honor/implement the DefaultCommandTimeout found in NetTiersProvider as the CommandTimeout value for command execution.


Barring a change to the templates, a possible workaround is the following code:

// adjust command timeout if the provider is a SQL database
Data.SqlClient.SqlNetTiersProvider p =
DataRepository.Provider as Data.SqlClient.SqlNetTiersProvider;

if (null == p)
{
// provider is not a SQL provider, do something else appropriate
DataRepository.Provider.ExecuteNonQuery("sp_MySlowSproc");
}
else
{
// get the SqlDatabase Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase db =
new SqlDatabase(p.ConnectionString);
// create a command for the slow sproc
System.Data.Common.DbCommand cmd =
db.GetStoredProcCommand("sp_MySlowSproc");
// set the timeout as set on the provider (or as needed)
cmd.CommandTimeout = DataRepository.Provider.DefaultCommandTimeout;
// execute the command (any of the Execute* family)
DataRepository.Provider.ExecuteNonQuery(cmd);
}


Another possibility would be to make use of the method:

Data.SqlClient.StoredProcedureProvider.GetCommandWrapper()

but it would only replace approximately 2 of the lines above, and considering the useStoredProcedure parameter it doesn't seem that appropriate.


Edit

Question

Answer

Edit

How can I get a count of the Total Items in a table?

The GetTotalItems() method in the Entity provider is broken: Using GetPaged to retrieve a Count

Edit

GetPaged doesn't return the correct page

The start parameter specifies page, not row number Edit

Component Layer

Edit

How does the DomainModel component layer implementation work?

Answer

Edit

How does the ServiceModel component layer implementation work?

Answer

Edit

Why don't some data access methods (such as Find) show up when I attempt to bind a data source to a service object?

There is no meta data telling the framework to display the function.

Place the following code above the method declaration:

DataObjectMethod(DataObjectMethodType.Select)

public virtual TList Find(string whereClause)



Recompile and you should now see that method available. Edit

Web Layer

Edit

What is the Web Library?

The NetTiers Web Library is a set of Controls and Objects that provide powerful tools to make your web development projects with NetTiers much easier and more efficient. The Web Library offers both Strongly Typed DataSource Controls as well as the more generic EntityDataSource. These are inherited from the ObjectDataSource, but have been improved to exploit the functionality of the NetTiers framework. You can find more info in the Web Layer section of this wiki.

Edit

Question

Answer

Edit

WinForms Layer

Edit

What is the WinForms library?

The WinForms library is similar to the NetTiers Web Controls library, but is still in a developmental stage. It will be a suite of Controls and Objects that will make your WinForms development easier and more efficient.

Edit

Question

Answer

Edit

Unit Tests Layer

If I want to use NUnit to test the data access and entity layer, how can I generated the tests?

Edit

Question

Answer

Edit

Web Services Layer

Edit

What is the WebServiceClient Layer? Why not just call the WebService directly?

Answer

Edit

Question

Answer

Edit

WCF Layer

Edit

Question

Answer

Edit

Question

Answer

Edit

Data Grids and Related Tables

((( Edit

How do I display related data in my ASP.net GridView?

Display related data in an ASP.NET GridView control Edit

How do I display related data in my winforms GridView?

Display related data in a WinForms GridView control Edit

Security

((( Edit

How to use Security Application Block with NetTiers

Use the Security Application Block with NetTiers

ScrewTurn Wiki version 2.0.31.