, efproviderwrappertoolkit, version = 1.0.0.0, culture = neutral, publickeytoken = def642f226e0e59b" />
Dbproviderfactories>
System. data
How to append log4net output:According to the above steps, some code is added to the extension class of objectcontext. For details, see the comments in the Code:[C-sharp]View plaincopyprint?
PublicPartialClassExtendednorthwindentities: northwndentities
{
Private StaticIlog logger;
StaticExtendednorthwindentities ()
{
// Re
WebMisCentral-the Client is compatible with MySql databases. because WebMisCentral uses EF5.0, it is very easy to adapt. The following describes the operation:
1. in the ElegantWM. WebUI layer (or ElegantWM. DAL), download MySQL. Data 6.7.5 through NUGET.
2. modify Web. config as follows:
.....
......
........
Note that the blue part above is newly added, and the rest is not required.
Specifically, you can add multiple database connection st
= Ps =Dalparty. Find (criteria. ownerid, criteria. Name,True, Criteria. maxresult );
}
Raiselistchangedevents =True;
}
A session exists. When accessed through a data object Delayed loading of data in a one-to-multiple relationship does not throw an exception.
B, AnyCud(Add, delete, modify, and delete) an event session is used. An example is as follows:
Protected Override VoidDataportal_update ()
{
This. Raiselistchangedevents =False;
Using (Castle. activerecord. transaction
, tracker is half the size of storage. This setting is because the tracker connection is very fast, and the storage connection needs to process file transmission, slow, so the affected connection pool needs to be larger;
The use of client code is actually very simple. First you need to apply the DLL of the client assembly, and then put fastdfs. config and log4net. copy the config file to your web config folder (or you can store the configuration in a unified directory), start the DFS client at
China Telecom's IP address has been refreshed for a while, so I wrote a class to send emails from public IP addresses to my mailbox, Gmail, and 163 can all use javaspclient. QQ does not seem to work, I found it online, saying that QQ's SMTP cannot adapt to unzip pclient public class sendemailhelper {Private Static readonly ilog log = logmanager. getlogger (typeof (sendemailhelper); public static void sendem
C # Use log4net to easily record local logs in step 4,
Here, record the steps for logging local logs using log4net in my project. It is difficult and mysterious before it is done. Once it is done, it is actually not that difficult. In fact, everything is the same. Next I will share my experience with log4Net.
Step 1: search for and download the Log4Net dll file from Nuget package management in Visual Studio, for example:
Select the project to be installed (select the class library that require
configured size, a new file log will be created, and the old file will be renamed as "log file name _ date_time. log" (such as info_20161208_011105.log ).
Daily Rolling generates different files every day.
The list of generated log files can be found below:
info_20161207_101105.loginfo_20161207_122010.loginfo_20161208_011110.loginfo_20161208_015010.loginfo.log
The log file currently being written is info. log.
The key code is as follows:
/*** Create a log file ** @ param lfi */private void crea
1. Configuring AOP through XML1.1 Creating an AOP slice class@Aspectpublic class Mkztaspect {private static final Logger log = Logmanager. GetLogger(Mkztaspect. Class);public void Mkztaround (Joinpoint point) {System. out. Print("starts execution of the module state slice.");Methodinvocationproceedingjoinpoint B = (methodinvocationproceedingjoinpoint) point;Object obj = b. Gettarget();object[] args = point.
(2) Use log4net to write custom database logs and log4net Databases1. Configure the Project Environment
1.1 this article only shows the operations to modify the configuration. For the first time you introduce the log4net environment, refer to the above.
1.2 install the mysql-connector-net.msi environment ,. And manually generate the database log information table.2. Configure log4net. config
2.1 modify log4net. config
3. Sample Code
3.1 modify LogHelper
Namespace July. demo. win {public class Lo
root node specifies the selected appender. logFileAppender is used in this example. (Text File output ). the output format is defined in the Appender definition. and the location of the target text file. (The starting position is the application root directory. (web. config directory ).7. You have configured log4net at the current location. It can be directly used in our application.8. The following describes the application methods:To output logs, you must first obtain the logger with an alias
file. At this time, you only need to copy the content in the log4net tag and do not need configSections.
3. Read the configuration in the application codeThis step is very simple. You can read the log4net configuration in the assemblyInfo. cs file of the application assembly.For WINFORM applications, you can add[Assembly: log4net. Config. DOMConfigurator ()] or[Assembly: log4net. Config. XmlConfigurator ()]For WEBFORM, you can add[Assembly: log4net. Config. DOMConfigurator (ConfigFile = "web. c
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.