Category Archives: 8235

Embedded sqlMap.config

If you are like me you would like to embed sqlMap.config file for your ibatis project. Although its not provided out of the box but its very simple to implement.


All you have to do is to write your own sqlMapper implementation.The core logic revolves around building DomSqlMapBuilder.


 protected static void InitMapper()
        {
            DomSqlMapBuilder builder = new DomSqlMapBuilder();
            XmlDocument sqlMapConfig = Resources.GetEmbeddedResourceAsXmlDocument(“YourNamepspace.YourConfigFile.config”);
            mapper = builder.Configure(sqlMapConfig) as SqlMapper;
        }


 


for more details do check out http://opensource.atlassian.com/confluence/oss/display/IBATIS/How+do+I+use+an+embedded+sqlMap.config+file