Remember how to use embedded in config or XML.

Source: Internet
Author: User

When configuring ibatis.. Net sqlmap. in config, the error "unable to load embedded resource from assembly" is often prompted. This file exists in a project and is in the root directory, in addition, the generation operation is "embedded resources ". This error is prompted, which is defined:

<Properties embedded = "database. config, piggywinform. Data"/>

After searching for relevant information on the Internet, we found that multiple ". ", instead of a file name here. Therefore, after I add a namespace in front of the file, I did not report this error. This reminds us that the embedded format is:

<Properties embedded = "<namespace> database. config, <ProgramSet> "/>

If the set and namespace of a project are the same, the <namespace> in front of the file can be omitted.

 

Why embedded? The purpose is to ensure security, especially when developing a winform project, so as to prevent client tampering or XML or other configuration files from being modified due to some other reasons. In particular, the SQL statements in the sqlmap of ibatis.

 

Today, I think it is uncomfortable to put the xml configuration file of ibatis in the root directory. Put the XML into the map folder. Compile and debug the file directly. As with speculation, an error is indeed reported, prompting that the file cannot be found. Then modify the configuration file and modify embedded:

<Sqlmap embedded = "piggywinformtemplet. Data. Auto. Map. myperson_auto.xml, piggywinform. Data. Auto"/>

Actually succeeded. Therefore, the true format of embedded is:

<Properties embedded = "<namespace>. <relative path>. database. config, <Assembly>"/>

Original Works from the effort to be lazy, reprint please explain the source of the article: http://www.cnblogs.com/kfarvid/

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.