EditFrequently Asked Questions
EditGeneral .netTiers
EditWhat 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.
EditWhere do I download the latest .netTiers templates?
You can find the latest copy of the code at
Nightly Downloads
EditWhat 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.
EditWhat 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.
EditHow fast is .netTiers compared with other code generators/Object-Relational Mappers?
EditWho 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.
EditCode Generation
EditHow 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.
EditEntity Layer
EditHow 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.
EditData Layer
EditI 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.
EditQuestion
Answer
EditHow 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 CountEditGetPaged doesn't return the correct page
The start parameter specifies page, not row number
EditComponent Layer
EditHow does the DomainModel component layer implementation work?
Answer
EditHow does the ServiceModel component layer implementation work?
Answer
EditWhy 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.
EditWeb Layer
EditWhat 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.
EditQuestion
Answer
EditWinForms Layer
EditWhat 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.
EditQuestion
Answer
EditUnit Tests Layer
If I want to use NUnit to test the data access and entity layer, how can I generated the tests?
EditQuestion
Answer
EditWeb Services Layer
EditWhat is the WebServiceClient Layer? Why not just call the WebService directly?
Answer
EditQuestion
Answer
EditWCF Layer
EditData Grids and Related Tables
(((
EditHow do I display related data in my ASP.net GridView?
Display related data in an ASP.NET GridView control
EditHow do I display related data in my winforms GridView?
Display related data in a WinForms GridView control
EditSecurity
(((
EditHow to use Security Application Block with NetTiers
Use the Security Application Block with NetTiers