Even component

zhaozj2021-02-16  61

This is really impossible to be a technical article, just to make a statement on some components I have developed, I hope to make component-based development to provide some ideas:

First, storm.cryptography

Used to encrypt the string encrypted and hash classes.

The addition of the string of the string uses the RC2 algorithm with the SHA1 algorithm.

Data encryption key initialization The vector is saved in * .appkey.sto, and * .appus.sto, where * represents the key identifier to distinguish which pair of key files to use

By default, these two files are saved in the application installation directory, but for web applications, these two files will be saved under the launch directory of the application, IIS5 is Windows / System32, IIS6Windows / System32 / inetsrv

It is recommended to add these two files (any binary) to easily uninstall the application when making an installer. And pay attention to the backup file.

SHA1PROVIDER class is used to have a string of string and confirm that the data is not changed.

It is recommended to use an encryption algorithm and a hash algorithm at the same time.

Second, storm.appsetting

The class configured for the application configuration, the application configuration data is encrypted with the RC2 algorithm, and the SHA1 algorithm is used to prevent data from being modified.

The configuration file path in the component is specified by "appsettingfile" in the application configuration file. If you do not specify, for the Windows Application Profile, in the program installation directory, for the web application, save it with respect to the application launch directory. IIS5 is Windows / System32, IIS6Windows / System32 / inetsrv

If you use a relative path, the Windows application relates to the program installation directory, the web application is started with the application startup path, IIS5 is Windows / System32, IIS6Windows / System32 / IneTsrv

If you do not specify an XML file name, the file name is "appsetting.xml"

AppConfig.ApplicationName is used to set the name of the application, which will be useful in many places.

Data Dictionary

AppConfig (System Settings Table)

Key: The program set button PK

Value: The value of the program settings

Hash: Hash with the program setting value

Remark: Remarks

Third, storm.dbexcute

Get the database connection configuration and query database data, add, modify, and delete.

Use this component to keep your system flexible and versatile, don't worry about which database is used by users.

Storm.dbexecute.dbconfig provides a related configuration of a database connection.

Support for multi-database connection configuration

Support XML configuration file

Support SQL Server, Oracle, ODBC and OLEDB

Default Database Connection XML Format Configure the setting of "DBCON" in storm.appsetting configuration file, the database type is "dbtype"

Non-default database connection XML format configuration is determined by the "* dbcon" setting by storm.appsetting configuration file, the database type is "* dbtype"

Among them, the asterisk represents the database ID

Storm.dbexecute.ModifyDatabase provides actions that queries, add, modify, and delete database data.

Support for multi-database operations

Support SQL Server, Oracle, ODBC and OLEDB

Automatically generate SQL statements

Supports multiple tables in the same database to operate simultaneously

Support open concurrency

Support transaction rollback

note:

For multi-table operation, because the interval is associated, the order in which the operation is important, the order of this component operation is to post-post-back processing from the data sheet array, please pay attention to the order of table processing! Storm.dbexecute.xmlexecute provides classes that operate on a dataset on the hard drive in XML format,

The default XML format file is deployed by the "XMLPath" setting of "XMLPSetting" in storm.appsetting, otherwise it will be placed directly in the application directory (for web applications, saved in the application launch directory relative to the application. IIS5 is Windows / System32, IIS6Windows / System32 / inetsrv)

Absolute and relative paths, for web applications, relative path representation relative to the application startup path, IIS5 is Windows / System32, IIS6Windows / System32 / INETSRV

For example:

Non-default XML format files save paths from "* xmlpath" in storm.appsetting configuration files Decide that the asterisk represents the specified XML fileset name, otherwise, it will be placed directly in the application directory (for web applications) It will be saved in the launch directory relative to the application, IIS5 is Windows / System32, IIS6Windows / System32 / inetsrv)

Absolute and relative paths, for web applications, relative path representation relative to the application startup path, IIS5 is Windows / System32, IIS6Windows / System32 / INETSRV

For example:

Four, storm.exceptionManager

This component is used for error management.

You can customize the information of the error to display friendly information to the user.

This component has three related files ExceptionLog.xml, CustomOutMessage.xml and ExceptionList.xml;

The storage path of the above file is determined by the settings of "ExceptionPath" in the configuration file of storm.appsetting. Otherwise, it will be placed directly in the application directory (for web applications, it is saved in the application launch directory, IIS5 is Windows / System32, IIS6Windows / System32 / inetsrv)

Absolute and relative paths, for web applications, relative path representation relative to the application startup path, IIS5 is Windows / System32, IIS6Windows / System32 / INETSRV

For example:

Customized error handling information is stored in the ExceptionList.xml file, you can use the logaccess.saveExceptionDetail method disclosed by the component. When writing, it should be noted that the component is a way to write instead of additional writing.

When an error occurs, the component will write the error log into ExceptionLog.xml, which can be read in the system using the logaccess.readlogfile method disclosed in the component. Or you can write the error log write to the system's event log, you can see in the log of "storm" in the system event log, the source of the log is specified in the "ApplicationName" setting in storm.appsetting configuration file.

The user can specify that in the XML file or write to the system's event log, or two, this setting is saved in the "ExceptionLogType" setting in the storm.appsetting configuration file, the option to set the value of the canuseExceptionLogTYPE enumeration

Error analysis and matching Depending on the Type and Inmessage1, Inmessage2, Inmessage3, INMESSAGE2, INMESSAGE3, INMESSAGE4, ​​inMessage3, INMESSAGE4, ​​where Type is an exception, using a fully qualified name, INMESSAGE1 ~ 4 is the keyword in the error message.

The above four match conditions constitute a hierarchical relationship:

Type.inMessage1.inMessage2.inMessage3.inMessage4;

When analyzing the match, you first searched the error type of Type.inMessage1.inMessage2.inMessage3.inMessage4, if you can't find it, find Type.inMessage1.inMessage2.inMessage3 completely match the error type, then find Type.inMessage1.inMessage2 Matching error types to push.

After the match is found, the component displays user information to the user based on Outmessage and Helplink in ExceptionDetail.

This component multi-language friendly information and log information, the Language field in the ExceptionDetail record specifies which language, if it is empty, the default record is used when there is no relevant language record.

CustomOutMessage is used to display generic information to users. If you do not find the display (UnchartedExceptionMessage, if "Unknown Error!"), Notify the user to display an exception display (SystemExcetionMessage, such as "System Error", Please do some operations (pleaseDoSomethingMessage, such as "contact with the administrator"). CustomOutMessage also uses the language of the Language field. The Language field is the default if you do not find the matching when you find the front thread language.

Since the error message is used in different languages ​​based on the cultural settings of the thread, INMESSAGE1, INMESSAGE2, INMESSAGE3, INMESSAGE2, INMESSAGE3, INMESSAGE2, INMESSAGE3, and INMESSAGE4 are considered in ExceptionDetail.

Data Dictionary

CustomOutMessage (custom output information)

Language: Language code, such as EN-US, ZH-CN PK

UnchartedExceptionMessage: The information displayed when you find the abnormality, such as "unknown error!"

ERROREXCEPTIONMESSAGE: Find the information that is notified when the error level is "error", notifying the user to display information when an exception is abnormal, such as "System Error"

ERRORPLEASEDOSMETHINGMESSAGE: Find the error level to "Error" to notify the user as shown in subsequent operation, such as "Please contact the administrator!" FailureAudITEXCEPTIONMESSAGE: Find the error level to "Failureaudit" When the matching exception is displayed when it is displayed. Information, such as "System Error"

FailureauditpleaseDoSomethingMessage: Find the error level to "Failureaudit" to notify the user as shown in subsequent operation, such as "Please contact the administrator!"

InformationExceptionMessage: Find the error level of "Information" to notify the user to display information when an exception is displayed, such as "System Error"

InformationPleaseDoSomethingMessage: Find the information displayed when the error level is "information", notifying the user, if you are in subsequent operation, such as "Please contact the administrator!"

SuccessAuditExceptionMessage: Find the error level to "SuccessAudit" to notify the user to display information when the user occurs, such as "System Error"

SuccessAuditpleaseDosomethingMessage: Find the information that is notified when the error level is "successAudit", informs the information displayed in subsequent operation, such as "Please contact the administrator!"

WARNINGEXCEPTIONMESSAGE: Find the error level to "WARNING" to notify the user to display information when the user occurs, such as "System Error"

WARNINGPLESEDOSMETHINGMESSAGE: Find the error level to "WARNING" to notify the user to display the information displayed in subsequent operation, such as "Please contact the administrator!"

LogtimeHeader: Information header of abnormal occurrence time

ExceptionTypeHeader: Abnormal type information head

ExceptiomoriginalMessageHeader: Abnormal original information information header

ExceptionSourceHeader: An exception application or object information header

ExceptionStackTraceheade: Unusual stack information head

ExceptionTargetsiteHeader: Method information of abnormal exception

ExceptionHelpLinkHeader: Exception Help Link Information Head

CustomMessageHeader: Abnormal system administrator custom information information header

CustomhelPlinkHeader: Exceptions System Administrator System Administrator Custom Help Link Information Head

UserNameHeader: Username Information Header

ExceptionInducedPathHeader: Module path information header

EXCEPTIONDETAIL (abnormal matching table)

GUID: full sentence unique identifier PK

Language: Language code, such as EN-US, ZH-CN

EventLevel: Event level, must be the value in EventLevel enumeration

Type: Abnormal type, using a fully qualified name

INMESSAGE1: Abnormal Original Information Keyword 1

INMESSAGE2: Abnormal Original Information Keyword 2

INMESSAGE3: Abnormal Original Information Keyword 3

INMESSAGE4: Abnormal Original Information Keyword 4

Outmessage: Executive administrator defines user prompt information Helplink: Executive administrator defined help link

ExceptionLog (exception log table)

GUID: full sentence unique identifier PK

EventLevel: Abnormal grade, is the value in EventLevel enumeration

Logtime: Expected time

ExceptionType: Abnormal type

ExceptiomoriginalMessage: Abnormal original information

ExceptionSource: An exception occurs or objects

ExceptionStackTrace: Exception Stack

ExceptionTargetsite: Method for causing exceptions

ExceptionHelplink: Excetion Help Link

CustomMessage: Unusual administrator defined information

CustomHelpLink: Executive administrator defined help link

UserName: System users who triggers anomalies

ExceptionInducedPath: Module path that occurs

Five, storm.advancesearch

For the components used to implement advanced queries, storm.advancesearch.advancesearchOption is used to assemble query conditions into the Hash table, storm.advancesearch.searchassemblag is used to assemble query statements based on query conditions in the Hash table.

Currently support SQL

Oracle will be supported in the future

For web pages, you only need to pass the web control to the component, the component can automatically determine the query criteria, the special words such as "--select -" define in a dedicated XML file, default "--SELECT -"

File storage path determines the "XMLPath" setting by storm.appsetting configuration file, otherwise, it will be placed directly in the application directory (for web applications, it is saved in the application launch directory, IIS5 is Windows / System32 , IIS6Windows / System32 / inetsrv),

Absolute and relative paths, for web applications, relative path representation relative to the application startup path, IIS5 is Windows / System32, IIS6Windows / System32 / INETSRV

File name MultilanguageseelectrData.xml

Data Dictionary

MultilanguageSelect (select word multilingual table)

Languagecode: language code, such as EN-US, EN-CN PK

SelectString: The selection of the drop-down box, such as "--select -"

Sixth, storm.webserviceauthenticationmodule

A component for implementing WebServices Custom SOAP header authentication. Instructions for use:

Using SOAP to send account information to the web service is a relatively secure way to pass the full-time portal information, and do not have to deliver a certificate for each WebMethod (as a part of the parameter). If you still feel that you can, you can The SOAP header is encrypted, or simply uses the SOAP to deliver the security certificate. Here only describes how to authenticate authentication using SOAP does not encrypt the username and password.

First, you will be a custom HTTP module (that is, this webserviceauthenticationmodule) and registers in WebConfig, as shown below:

Add a SOAPAUTHHEADER field type defined in the Web Services class, and apply the SOAPAUTHHEADER attribute to our web service method, and then use the name of the name for this field to define the constructor of this property;

For the client, each time the request is sent to WebServices, you need to populate the SOAP header. After WebServices defines the SOAP header, the client's proxy class will also generate the corresponding class agent, first create a service object instance representative Our web service, then create a SOAP header object instance, and fill the SOAP header, follow the SOAP header associated with the agent to use our web service.

The above is the implementation method, and then the verification process of this authentication method is again. When a service request is sent to the server, the request will be intercepted by WebServiceAuthenticationModule, and WebServiceAuthenticationModule starts to analyze the request's SOAP header, and the client name and password sent by the client are parsed, and authenticate is performed. If the authentication passes the user, WebServiceAuthenticationModule will issue authentication tickets to the user; if the authentication fails, WebServiceAuthenticationModule throws a message as "Access Deny!", Which can then interceise the exception and process it. .

Please check the company's WebServices example.

This module uses the user login service provided by Storm.USERAUThentication.

Seven, storm.multilanguage

Class for reading and writing multilingual data

This class can operate on string data tables in the database and XML formatted string data tables. The default database table name is displayString, the default XML file name is DisplayStringData.xml

The string data table in the database supports the operation of multi-database tables and the same data. The database connection string is specified in the configuration file of storm.appsetting.

For a string data table in the XML format, the default storage path is determined by the "XMLPath" setting of the storm.appsetting configuration file, otherwise, it will be placed directly in the application directory. For web applications, it will be saved in relative to the application. In the launch directory, IIS5 is Windows / System32, IIS6Windows / System32 / InetSRV

Non-default XML format files are determined by the setup of "* xmlpath" in storm.appsetting configuration file, where the asterisk represents the specified XML fileset name, otherwise, it will be placed directly in the application directory, for web applications The program will be saved in the launch directory relative to the application, IIS5 is Windows / System32, IIS6Windows / System32 / INETSRV

The LanguageData Data Set is used to record the language available in the application, and the traffic path is determined by the "XMLPath" set by the application configuration section. Otherwise, it will be placed directly in the application directory. For web applications, it will be saved relative to Under the application launch directory, IIS5 is Windows / System32, IIS6Windows / System32 / IneTSRV supports absolute and relative paths. For web applications, relative path representations relative to the application startup path, IIS5 is Windows / System32, IIS6Windows / System32 / inetsrv

The default language of the application is set in "DefaultLanguage" in storm.appsetting configuration file.

Data Dictionary

DisplayString (Data Display Table)

Languagecode: language code, such as ZH-CN, EN-US PK

Refguid: related number PK

Display: Display Character

Language (system available language table)

Languagecode: language code, such as ZH-CN, EN-US PK

Name: Language Name, such as Chinese, ENGLISH

Eight, storm.exchrate

The class used to operate the exchange rate.

Exchange rate performance uses three data sheets to express: currency, defaultexchrate, floatexchrate

Components support multiple languages ​​and different exchange rates in each period. For multilingual support requires additional storm.multilanguage components to support.

Ability to operate the exchange rate module in multiple databases

The various functions that are outside the multilingual support can be achieved without using the Storm.Multilanguage components.

Currency table is used to record basic information of various currencies

DEFAULTEXCHRATE is used to record all periods of various currency relative to the US dollar.

FLOATEXCHRATE is to consider the exchange rate of each period of each of the records that may be directly converted between the two currencies between the two or two two or two.

The various methods in the call class can get all exchange rate information, or a long-term for the US dollar, for other currencies, from other currencies

Or you can get long-term exchange rates from some currency to some currency

Or you can get a certain amount of money or purposeful exchange rate

Or you can get the exchange rate for some currency to the dollar, for some currency to other currency

Enter the quantity of a certain currency, you can get the number of time target currency

For default exchange rates and floating exchange rates

Which exchange rate can be specified by parameter getfloatexchrate

After the method is called, getfloatexchrate can know which currency actually used.

If the two exchange rates do not exist, the calculation will return 0

For data updates, modules provide update the entire dataset, update exchange rate array or only the function of single exchange rate information

Data Dictionary

Currency (currency table)

CurrencyID: Currency ID PK

Symbol: currency symbol

ABBR: Currency Abbreviation

Name: currency name

Nameguid: currency name Guid

Remark: Remarks

DefaultExchrate (default (for US dollar) exchange rate)

DEXCHRATEID: Default Exchange Rate ID PK

CurrencyID: Currency ID FK Currency

Exchrate: Exchange Rate

BeGindate: effective time

Remark: Remarks

FLOATEXCHRATE (floating (two currency) exchange rates)

FEXCHRATEID: Floating Exchange Rate ID

OrigcurrencyID: Source Currency ID FK Currency

DestcurrencyID: Target Currency ID FK CurrencyExchrate: Exchange Rate

BeGindate: effective time

Remark: Remarks

Nine, storm.userauthentication

Components used to use the user login and permission control.

Log in to use storm.appsetting configuration files UserConnectionstring Provide database connection configuration, using users, role, ruserrole, modulefunction, role, ruserrole, modulefunction, rolefunction, userfunction, and usercustomparam tables for user identity data in the background database.

There are also list of userParamSettingData.xml files in XML format to provide a list of customizable settings.

There is NVARCHAR type Name and Password fields in the UserS table, as well as the Bit type InUse field and use Name as the primary key without using the GUID.

There is nvarchar type ROLENAME in the role table and

There is UserRole table, RoleName is associated with the use of the Users and Role tables, respectively, and two together as the primary key.

There is nvarchar type functionID in the modulefunction table and is the primary key.

There is ROLENAME in the rolefunction table, and the functionID is associated with the role table and the modulefuntion table, respectively, and two together as the primary key.

UserName, FunctionID in the userfunction table is associated with the user table and the modulefuntion table according to the field and two together as the primary key.

Usercustom table is UserName, Parameter separately associates with the userParamSetting table in UserParamSetting Data.xml, and two together as a primary key. VALUE saves the user-defined setting value encrypted by the RC2 algorithm. Hash saves user-defined settings. The value is used to have a value after the SHA1 algorithm has been hasced.

This module reads only the information in the table and does not perform any maintenance operations.

The user table does not use the GUID to use Name as the primary key; in the system using this authentication module, use the PUBLIC IPRINCIPAL User built into the .NET framework as an identity, which uses Name as the only identity identifier, thereby The UserS table in the system database does not use the GUID, but uses Name as the primary key, and this can also effectively ensure that the user using the same user name in the system is only one. It is based on the following premise: the username in the system unique and no longer change the username after the user is created, this premise is reasonable and necessary.

Data Dictionary

Role (role table)

RoleName: Role Name PK

Users (user table)

Name: Username PK

Password: user password

InUse: Whether is enabled

RUSERROLE: (Role Distribution Table)

Username: Username PK FK Uses

Rolename: Rolen PK FK ROLE

ModuleFunction (System Menu)

FunctionID: Function ID PK

Rolefunction (Role Permissions)

FunctionID: Function ID PK FK ModuleFunction

ROLENAME: Role ID Pk Fk Role

UserFunction (User Rights Form)

Username: Username PK FK Uses

FunctionID: Function ID PK FK ModuleFunction

UserCustomParam (User Custom Settings Table)

Username: Username PK FK UserSparameter: Settings PK FK UserParamSetting

Value: Value of User Custom Settings

Hash: User Custom Setting Hash

UserParamSetting (system can be user-defined) table)

ParameterName: You can customize the name of the settings

DEFAULTVALUE: Default

Description: related description

Ten, storm.common

This component provides some relatively fine but very useful features.

This component currently has three namespace storm.common.sql, storm.common.Web and Storm.common.Windows, providing small and practical functions in related fields, respectively.

Storm.comMon.sql.filter provides a character filter for SQL.

Storm.comMon.Web.FileAccess is used to access the file on the server.

The default storage path of the file is determined by the setting of "PostedFilePath" in the storm.appsetting profile. Otherwise, it will be placed directly in the application directory, set support relative path or absolute path, relative path finger relative path to application path

The non-default storage path of the file is determined by the "* PostedFilePath" setting in the storm.appsetting profile, where the asterisk represents the name of the fileset, otherwise, it will be placed directly in the application directory, set support relative path or absolute path, Relative path refers to the application path

In order to prevent file rename, the server's file is renamed, the file name format is the original file name current time, so the server file list should save two data fields, original file names, and new file names.

Storm.comMon.Web.Filter Character filter for the web page.

Storm.comMon.Web.jscript Class for the Java script related operations.

Storm.common.Web.Message pops up (prompt, message ...).

Storm.comMon.maths is used for mathematical functions

Eleven, storm.smartclient.client.FileTransfer

This component encapsulates the file transfer function between the Client end of SmartClient.

Twelve, storm.smartclient.client.localdataAccess

This component encapsulates the local data read and write function of SmartClient's Client.

Thirteen, storm.smartclient.client.moduleLoader

This component encapsulates the module loading function of SmartClient's Client.

Fourteen, storm.smartclient.client.interfaces

This component encapsulates the common interface of the Client end of SmartClient.

Fifteen, storm.smartclient.server.common

This component encapsulates the SMARTCLIENT's Server end as universal feature: module list access, transferring files between clients.

转载请注明原文地址:https://www.9cbs.com/read-24287.html

New Post(0)