Nettiers documentation translation (1) -- Introduction

Source: Internet
Author: User
Tags sql client

Directory

    •  CodeGenerate
    • . Nettiers getting started
    • Current version features
    • . Nettiers Architecture
    • Enterprise database application module
    • Nunit and vsts
    • Scheme Planning
    • . Nettiersapi level
    • . Nettiers API user
    • Service Layer
    • Data access layer
    • Entity Layer

Code Generation

Codesmith is a template-driven code generation software that can generate C #, Visual Basic. net, and any language or text you want. As developers, many aspects of our work are full of repetition. In these aspects, code generation has proven to respond and has become a necessary and popular way. Code Generation helps us avoid some mistakes. Once you have mastered the code generation steps, the chance to generate a bugs in the code will be greatly reduced. Even if a bug occurs, you can easily modify your template to generate code again, and then the bug will disappear throughout the system. This is much better than the method you used previously: you can find all instances in scenarios where the running fails due to this bug. We do not recommend using the actual functions and powerful refactoring tools. They can help us a lot. However, it is very limited when they encounter modifying behavior actions, and this code generation is very suitable. Codesmith allows you to define attributes that contain rich metadata to generate a powerful template set. A better message is that they all look like Asp.net. your selection of rich metadata reports RDBMS, XML ,. net types, and you can even construct your own metadata.

. Nettiers getting started

. Nettiers is an open source codesmith template library written in C. The main purpose of this template is to help developers avoid simple and repetitive code writing, and provide a fully functional framework. With this framework, developers can focus on such aspects as the UI Layer, business rules, workflows,ProgramPerformance is more important to their programs. We should regard. nettiers as an application module that focuses on your domain model. In the future, we will pay more attention to horizontal mining rather than vertical development. In other words, in future versions, nettiers will focus on providing more content that can help you complete daily work tasks.

. Nettiers can effectively generate a set of correlated domain objects for existing databases based on the domain-driven design (MDD. Basically, MDD is the concept of a pre-designed model that can be used to generate your program. MDD is famous for many UML tools, such as Rational Rose. However, it is along with codesmith's ability to find a wealth of metadata through the schema searcher (schemaexplorer) That nettiers uses a data model that everyone is very familiar with to make the implementation of MDD very simple. (Poor translation: however, with the advent of codesmith's rich set meta-data via it's schemaexplorer, MDD has been participant ularly easy to adopt. nettiers through the familiar data model .) so ,. nettiers is responsible for being able to design a rational database and generate a great domain model for your database. Because the subject of a business application is centered on data,. nettiers provides the ability to process your data as easily as possible.

Current version features

The following is a summary feature list provided by. nettiers. You can use this document to obtain more information about these topics.

    • Generate a fully compilable solution for your program, including independent project and framework layers. You can start Program Development immediately after code generation.
    • Generate a full set of stored procedures for your domain. These codes can be run in the form of internal connections, just like parameterized SQL, not necessarily used as a stored procedure.
    • for tables in your database, Domain Models including object objects and their relational objects are automatically generated.
    • the advanced entity inspection rules engine can use any generated rules or user-delegated rules.
    • you can use all partial categories and all specific classes to write custom logic. The Code will not be overwritten during code generation.
    • use a custom generic collection class that implements. Net componentmodel APIs and can be bound, sorted, and filtered.
    • A complete website project has been created and configured in advance. You can operate on your data immediately.
    • a complete set of executable Web page controls are generated. The database can be used as the basic functional web page executable console.
    • Generate a complete set of strongly typed data source controls that provide design support for all your application interfaces. They are very similar to the object data source (objectdatasource), but are more specific, it is more friendly to developers.
    • the WebService application interface generated for your domain can be well applied to winforms software or smart client applications and can be easily configured.
    • Generate a set of completed unit test items for the data provider, which can cover about 50%. These tests use nunit or vsts.
    • the Code is fully annotated and can be applied to your documents. These annotations fully comply with Microsoft's naming guidelines.
    • all code is stored in a specific folder of the project. By default, the code is automatically included in the app_code folder of the generated project.
    • the data access layer interface supports the following queries: primary key, foreign key, index, many-to-many relationship, all, filtered paging query, and find ), you can also add, update, and delete databases.
    • you can write your custom Stored Procedure for your entity. nettiers encapsulates the stored procedure. This allows you to include custom logic in the. nettiers interface.
    • there are many more ...... Frankly speaking ......

. Nettiers Architecture

The data tier is composed of the business entity component (data itself) and the data access logic component (persistence logic.

This design is based on Microsoft's pattern and practice guidelines: designing data tier components and passing data through tiers.

Enterprise database application module

So far, you may say that. nettiers not only helps you access data more quickly, but also processes all aspects of the application more quickly. You may have heard of a saying or advice: more flexible than hard work .. Nettiers follows this principle when designing such a solution. It is really great to use the existing tools that bring us the best practices and follow the principles of the Microsoft model and practice team .. Nettiers is built on the enterprise database, and the enterprise database itself is an awesome provider-based framework that provides plug-ins for the common needs of many applications. These application modules include data access, logs, exception handling, application Health Metrics, cache, security, encryption, and so on !!! That is to say, you can use these functions without having to write or spend money to buy these components. You can find a lot of related information, as well as the Getting Started link provided later.

Enterprise Library developer site(Note: The link provided in the original article does not exist anymore. This is the link I found on Microsoft msdn)

Nunit and vsts

What if I leave the unit test application? Unit testing has become an integral aspect of today's applications, because it allows developers to move on. Adding a feature to your application will destroy 10 of the websites you wrote 20 years ago, and even you did not write it. You don't know how this new function works, nothing is worse than that. Unit testing allows you to write a small test code to overwrite and test the correctness of your methods and large pieces of code. You can simulate all possible scenarios supported by your application, or even deliberately make some effort to observe whether your application will respond correctly. Another reason why unit testing is so popular is the ability to provide deep insight into the behavior supported by APIs. You can learn how to expand existing APIs and interact with Entity classes generated for your domain .. Nettiers provides unit tests for your data APIs. They will be used when you customize your data APIs and you want to confirm that this will not disrupt other existing code. There are now many unit test kits. We provide support for the two most influential tool kits: nunit and Visual Studio team system. if you plan to use nunit, we strongly recommend that you download testdriven.net, which allows you to perform a simpler test in the Visual Studio environment.

1 [Test]
2 Public   Void Step_01_insert ()
3 {
4 // Establish additional pre-conditions here
5
6 Step_01_insert_generated ();
7
8 // Add additional verification here
9 }
10 /**//// <Summary>
11///Inserts a mock categories entity into the database.
12/// </Summary>
13 Private   Void Step_01_insert_generated ()
14 {
15 Using (Transactionmanager TM = Createtransaction ())
16 {
17 Mock = Createmockinstance (TM );
18 Assert. istrue (datarepository. categoriesprovider. insert (TM, mock ), " Insert failed " );
19
20 System. Console. writeline ( " Datarepository. categoriesprovider. insert (Mock ): " );
21 System. Console. writeline (Mock );
22
23

26}
27}
28

 

Scheme Planning

In the previous document, you have browsed all the projects generated in the whole project, and you can see that they are divided into several different projects. If you do not know much about multi-layer design, this can be used as an example first. If you don't understand why we have multiple loose layers, I will take you to explore and read some design ideas for a while. Read the beginner's designing data tier components and passing data through tiers White Paper to learn how multi-tier architecture works.

Why does it mean loose coupling?

A Loosely Coupled architecture is an open architecture that requires as much internal interaction as possible while obtaining as little information as possible from other layers. For example, the data access layer is an abstract layer that only knows how to access APIs. It does not know specific database knowledge or web service knowledge. When using the table orders API, you are sure that the abstract provider you are using understands the APIs of the orders provider (ordersprovider), such as getbyorderid (), insert (), update (), delete (). however, you cannot find any SQL statement or command to operate the database in these methods. Essentially, this layer only defines a contract, requiring any provider to implement this contract to successfully interact with other providers. This is also useful for switching between data providers, such as switching from the SQL server provider to the Web service provider, or vice versa.

It seems that more code and work are available. Why is this useful?

In fact, there are several factors that have led to technological changes. For example, the business is usually to buy or sell, but now new companies always like to use the latest technology, trying to reduce the cost of using the Enterprise Library for data access. They tried to use dlinq in. NET Framework 3.0, the next-generation data access technology of Microsoft. You can easily create a dlinq provider for proper loading, and your API is still running. The damage of code passing between layers is minimal.

Overall, the project is divided into the following (using northwind as an example ):

. Nettiersapi level

  • Northwind. Entities-The entity layer is designed based on the table mode, data transmission object, and domain model. This layer aims to transmit data between layers during persistence and data integrity. Customization includes some basic business rules, such as range detection, type monitoring, length, and formatting. Two attributes are connected by the displayed name, for example, a user class will have firstname + "" + lastname.
  • Northwind. Data-The data abstraction layer calls the globally unique datarepository to access the generated API. This is the entry point for accessing your data and knows the data types supported by your API. However, it does not understand the specific implementation of the provider.
  • Northwind. Data. sqlclient-Provider for Microsoft SQL server operations.
  • Northwind. Data. webserviceclient-The Web service provider, as a client, can call the endpoint of the web service described below. In this way, you can easily use. nettiers through a remote client. For example, you can only use a client.
  • Northwind. ServicesOrNorthwind. Domain-This layer provides application boundaries and data APIs for complex business logic rules. The options here are servicelayer mode or domainmodel mode. At this layer, you can define all review actions, but you do not want to implement all actions. This layer includes processors, which can be used to classify defined behavior implementations.
  • Northwind. WebServices-A disconnected web service project provides a usable web service endpoint that exposes data APIs. This is actually both a provider and a user. Because it will be called by the web service client layer, and the SQL client will be used on the architecture server side.

 

. Nettiers API user

 

    • Northwind. unittests-unit tests use APIs and provide unit tests for data access APIs.
    • Northwind. Web-this layer provides a set of available Asp.net control sets and helps you more effectively access the help class set during web application development.
    • Northwind. website-if you select this option, this is an entry-level website. A website project is automatically generated for you. The project contains correct references. After the project is generated, you can use the website to perform operations immediately.

. Nettiers Mode

The. nettiers team has made great efforts to use best practices for application development. We follow Microsoft's knowledge guidelines on how to use their platform in the best way, including the use of the Microsoft pattern and practice group class libraries.

The following is the main information about the pattern used in. nettiers 2.
They are mainly concentrated on the resources of the following outstanding developers:
Patternshare.org | dofactory.com | David hayden.com

Service Layer

Http://martinfowler.com/eaaCatalog/serviceLayer.html

Processors
By default is a pipeline:
Http://www.enterpriseintegrationpatterns.com/PipesAndFilters.html

But easily can be used with workflow management in:
Http://www.enterpriseintegrationpatterns.com/ProcessManager.html

Each individual processor uses:
Command
Http://www.dofactory.com/Patterns/PatternCommand.aspx

Flexible enough to be used within a strategy passed into the ctor to manage different behaviors in complex logic. http://www.dofactory.com/Patterns/PatternStrategy.aspx

Domainmodel + activerecord
Http://martinfowler.com/eaaCatalog/domainModel.html

Http://martinfowler.com/eaaCatalog/activeRecord.html

Data access layer

Singleton, decorator
Http://msdn2.microsoft.com/en-us/library/ms998426.aspx

Http://www.dofactory.com/Patterns/PatternDecorator.aspx

Data transfer objects:
Http://martinfowler.com/eaaCatalog/dataTransferObject.html

Repository provider:
Http://davidhayden.com/blog/dave/archive/2004/05/19/259.aspx

Entity Layer

Each entity-Memento,State,Domainmodel,Tablemodule


Http://www.dofactory.com/Patterns/PatternMemento.aspx

Http://www.dofactory.com/Patterns/PatternState.aspx#_self2

Http://martinfowler.com/eaaCatalog/domainModel.html

Http://martinfowler.com/eaaCatalog/tableModule.html

Entity Factory
Http://www.dofactory.com/Patterns/PatternFactory.aspx

WebService client-proxy
Http://www.dofactory.com/Patterns/PatternProxy.aspx

SQL expression-Builder
Http://www.dofactory.com/Patterns/PatternBuilder.aspx

(Note: the final resource index is not translated. The original Article is linked. Next article: Getting Started)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.