原文:https://codesmith.atlassian.net/wiki/display/Generator/Configuring+and+troubleshooting+a+Schema+Provider

The sections below will help guide you through using and configuring various Schema Providers that ship with CodeSmith Generator.

Creating a new connection string

Please read the adding a new database connection section before continuing.

The Data Source window will check to see if a schema provider supports showing Connection String designer. If it doesn't, then you must manually enter a valid connection string into the Connection String text box. You must enter in a valid connection string for the Provider Type you are trying to use.

  • If you're using the SqlSchemaProvider, connection strings follow the format used by the .NET SqlConnection.ConnectionString property.
  • If you're using the ADOXSchemaProvider, connection strings follow the format used by the ADO ConnectionString property.
  • If you're using the OracleSchemaProvider, please be sure to check out the link below for creating a connection string as well as the Connecting to an Oracle database section below.
  • If you're using the PostgreSchemaProvider, please make sure the following statement is included in your ConnectionString: Preload Reader = true;

For all SchemaProviders, please be sure to use the proper ConnectionString for the Database Provider you are using. A great resource for building database ConnectionStrings can be found here.

Configuring a Schema Providers behavior

A schema provider may contain additional configurable logic that changes how the schema provider behaves. For example, you may only want to show the various schema objects for the current logged in user or allow CommandResultSchema information to be retrieved.

These settings can be configured in the Generator Options Schema Provider section as shown above.

Oracle Schema Provider

Connecting to an Oracle database

The first step is to add a new Data Source. Once the Data Source window is open, you will want to select the OracleSchemaProvider from the Provider Type drop down menu.

Next, you will want to click on the ellipse button (...) to build the connection string.

You can also manually enter in a connection string into the Connnection String text box.

After you have filled out all of the required information, press the Test Connection Button or the OK button. If you could connect to your Oracle Server, then you are all done. If this doesn't work you may be scratching your head and thinking you are out of luck. The good news is your not. You will need to use a modified connection string that the Connection Properties UI doesn't account for.

"This is another type of Oracle connection string that doesn't rely on you to have a DSN for the connection. You create a connection string based on the format used in the tnsnames.ora file without the need to actually have one of these files on the client pc" (http://www.connectionstrings.com/oracle).

You will need to manually configure this connection string using the initial Data Source User Interface's Connection String text box (shown above).  Below is an example of using an TNS-Less (Transparent Network Substrate) connection string.

Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=MyOracleSID)));User Id=myUsername;Password=myPassword;

Please see the following website for more information on Oracle Connection Strings.

Installing Oracle Data Access Components (ODAC)

CodeSmith Generator is compiled as AnyCPU. This means that Generator will run as a 64bit process when you launch Generator outside of Visual Studio. If you are generating from within Visual Studio (32bit process), then CodeSmith Generator libraries will run as a 32bit process.

This is very important to understand as it determines which Schema Provider dependencies are resolved at run-time.

If you are trying to use the Oracle Schema Provider you may be presented with an error message that states a BadImageFormatException was thrown. This can be resolved by installing the ODAC libraries.

If you are running a 64bit version of windows, please install both the 32bit and 64bit versions.

Please visit the Oracle .NET Developer Center and download and install the latest versions of ODAC (32-bit64-bit). It is recommended that you restart your computer after installing the ODAC libraries.

MySQL Schema Provider

If you are trying to use the MySQL Schema Provider you may encounter the error message: 'The MySQL.Data.MySQLClient  is not installed on this computer'. This error can occur because the MySQL Connector/Net ( MySql.Data.MySqlClient DbProvider)  hasn't been installed on your machine.

Installing MySQL Connector/Net

Please download and install the latest MySQL .NET connector which can be found here. It is recommended that you restart your computer after installing the MySQL .NET connector.

Version 6.7.4 of the MySQL connector may not work in some circumstances. If you run into an issue where the connector isn't being resolved. It is recommended that you try installing an older version of the client.

Configuring MySQL Connector/Net

The MySQL Schema Provider doesn't require a specific version of the MySQL managed libraries. This is because it uses DbProviderFactories when interacting with MySQL. One must update all .NET Framework 4.0 machine.config's and add the MySQL provider to the DbProviderFactories element:

<system.data>
<DbProviderFactories>
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.7.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>

Please ensure that you update the Version number (E.G., Version=6.7.4.0) with the version of the MySQL Connector/NET that you installed.

The .NET Framework 4.0 machine.config's can be found here:

  • %windir%\Microsoft.NET\Framework\v4.0.30319\Config\machine.config
  • %windir%\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config

SQLite Schema Provider

If you are trying to use the SQLite Schema Provider you may encounter the error message: 'The System.Data.SQLite library is not installed on this computer'. This error can occur for two reasons:

  1. The System.Data.SQLite hasn't been installed on your machine.
  2. The System.Data.SQLite hasn't been properly configured.

Installing System.Data.SQLite

CodeSmith Generator is compiled as AnyCPU. This means that Generator will run as a 64bit process when you launch Generator outside of Visual Studio. If you are generating from within Visual Studio (32bit process), then CodeSmith Generator libraries will run as a 32bit process.

This is very important to understand as it determines which Schema Provider dependencies are resolved at run-time.

The first step is to ensure that you download and install the latest .NET Framework 4.0 version of  System.Data.SQLite.

If you are running a 64bit version of windows, please install both the 32bit and 64bit versions.
You can skip the following configuration steps if you install the legacy version of System.Data.SQLite hereThe older version configures itself by adding entries into your machine.config. 

Configuring System.Data.SQLite

The SQLite Schema Provider doesn't require a specific version of the SQLite managed libraries. This is because it uses DbProviderFactories when interacting with SQLite. One must update all .NET Framework 4.0 machine.config's and add the SQLite provider to the DbProviderFactories element:

<system.data>
<DbProviderFactories>
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
</DbProviderFactories>
</system.data>

The .NET Framework 4.0 machine.config's can be found here:

  • %windir%\Microsoft.NET\Framework\v4.0.30319\Config\machine.config
  • %windir%\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config
Next, you will need to copy the 64bit or 32bit SQLite assemblies that were installed via the System.Data.SQLite installer to CodeSmith Generators bin folder. This bin folder can be found in the location that you installed CodeSmith Generator to.
 

You should copy the 64bit SQLite assemblies if you are using 64 bit windows.

Finally, you are ready to start using the SQLite Schema Provider!

PostgreSQL Schema Provider

Connecting to an PostgreSQL database

Please follow the steps outlined in the "Creating a new connection string" section for information on creating a new data source.

Please see the following website for more information on PostgreSQL Connection Strings. Additional connection string parameters can be found here.

Please make sure the following statement is included in your ConnectionString: Preload Reader = true; Also you can limit what schema objects are returned by adding a SearchPath to your connection string.

Installing Npgsql

If you are trying to use the PostgreSQL Schema Provider you may be presented with an error message that states a FileNotFound was thrown. This can be resolved by installing the Npgsql libraries.

First, you will need to look at the error message and determine which version of the libraries need to be installed. This can be done by looking at the error message:
System.IO.FileNotFoundException: Could not load file or assembly 'Npgsql, Version=2.0.11.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7' or one of its dependencies. The system cannot find the file specified.

The error message is telling us that we need to install version 2.0.11.0 of Npgsql. We then navigate to the Npgsql downloadssection and look for this version. You will need to download the .NET 4.0 compiled version (E.G., ending with bin-ms.net4.0.zip). After this has been done, unblock the zipand extract the files to a folder.  Next run GacUtil from an elevated Visual Studio command prompt and gac the two extracted assemblies as shown below.

gacutil -i Npgsql.dll
gacutil -i Mono.Security.dll
 
Finally, you are ready to start using the PostgreSQL Schema Provider!

Configuring and troubleshooting a Schema Provider的更多相关文章

  1. CUBRID学习笔记 37 ADO.NET Schema Provider

    通常需要添加以下引用:   1 2 3 using System.Data; using System.Data.Common; using CUBRID.Data.CUBRIDClient; 定义连 ...

  2. CodeSimth - .Net Framework Data Provider 可能没有安装。解决方法

    今天想使用CodeSimth生成一个sqlite数据库的模板.当添加添加数据库的时候发现: .Net Framework Data Provider 可能没有安装. 下面找到官方的文档说明: SQLi ...

  3. Write your own Terraform provider: Part 1

    转自:https://container-solutions.com/write-terraform-provider-part-1/ This is the first part of a seri ...

  4. CodeSimth - .Net Framework Data Provider 可能没有安装。解决方法[转载 ]

    原文:http://www.cnblogs.com/chenrui7/p/3592082.html 今天想使用CodeSimth生成一个sqlite数据库的模板.当添加添加数据库的时候发现: .Net ...

  5. Terraform 自定义provider 开发

    内容来自官方文档,主要是进行学习自定义provider 开发的流程 开发说明 我们需要开发的有provider 以及resource 对于resource 我们需要进行crud 的处理,同时还需要进行 ...

  6. Writing Custom Providers

    转自:https://www.terraform.io/docs/extend/writing-custom-providers.html 很详细,做为一个记录 In Terraform, a Pro ...

  7. WebADI_Oracle ERP R12使用前WebADI设定(案例)

    2014-12-25 Created By BaoXinjian

  8. Oracle Metalink Notes Collection

    INV Note 123456.1 Latest 11i Applications Recommended Patch List Note 568012.1:FAQ: Inventory Standa ...

  9. Useful Articles for the Oracle E-Business Suite Technology Stack for Technical Consultant / DBA [ID

    Applies to:  Oracle Applications Technology Stack - Version: 11.5.10.2 to 12.1.3 - Release: 11.5.10 ...

随机推荐

  1. 3、Spring整合Hibernate

    经过前面的两节分析:1.Hibernate之生成SessionFactory源码追踪 和 2.Spring的LocalSessionFactoryBean创建过程源码分析 .我们可以得到这样一个结论, ...

  2. Linux下安装mysql-5.6.4 的图文教程

    在开始安装前,先说明一下mysql-5.6.4与较低的版本在安装上的区别,从mysql-5.5起,mysql源码安装开始使用cmake了,因此当我们配置安装目录./configure --perfix ...

  3. ajax练习习题二三级联动

    异步执行 1数据传输收发数据的时候不用等待对方接受,可以继续发送 2Ajax 在调用处理页面处理数据的时候,下面的代码可以继续执行,效率高 同步执行 1收发数据的时候要等到对方接受的成功,才可以继续发 ...

  4. Passing JavaScript Objects to Managed Code

    Silverlight If the target managed property or input parameter is strongly typed (that is, not typed ...

  5. hdu4185解题报告

    这里我居然能自己想想到怎么建图匹配,很是不容易... 题意:这里有一片油田,但是不是纯净的,有的地方是水,现在有一个捞石油的机器,但是这个机器捞的范围是固定的,是2*1的一个矩形大小,那么对于整个油田 ...

  6. linux目录

    转自:http://www.educity.cn/it/linux/201002040848221715.htm 对于linux新手来说,最感到迷惑的问题之一就是文件都存在哪里呢?特别是对于那些从wi ...

  7. SASS -- 基本认识

    SASS 是一种 CSS 的开发工具,提供了许多便利的写法,大大节省了设计者的时间,使得 CSS 的开发,变得简单和可维护. SASS 提供四个编译风格的选项: * nested:嵌套缩进的 css ...

  8. CSS的display属性

    网页设计中最常用的标签p.div.h1-h6(默认为块级元素),span(默认为内联元素) 内联,内嵌,行内属性标签: 1.默认同行可以继续跟同类型标签: 2.内容撑开宽度 3.不支持宽高 4.不支持 ...

  9. linux嵌入式系统驱动程序的阻塞与异步

    对于那些需要进程独占的设备,需要使用linux提供的阻塞编程.步骤如下: 1.在设备驱动程序中定义该设备的进程等待列多,并将其初始化 static wait_queue_head_t wait_que ...

  10. HDU 3537 (博弈 翻硬币) Daizhenyang's Coin

    可以参考Thomas S. Ferguson的<Game Theory>,网上的博客大多也是根据这个翻译过来的,第五章讲了很多关于翻硬币的博弈. 这种博弈属于Mock Turtles,它的 ...