Reputation: 7814
I've created a console application focused on C#3.5 and added a reference to System.Web, System.Configuration and Subsonic.Core. Also have in config file
<?xml version="1.0"?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="UpdateCotswolds.Properties.Settings.Live_IntegraConnectionString" connectionString="Data Source=POSERVER;Initial Catalog=Live_Integra;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
I've then edited Settings.ttinclude
const string Namespace = "Integra.Data";
const string ConnectionStringName = "UpdateCotswolds.Properties.Settings.Live_IntegraConnectionString";
//This is the name of your database and is used in naming
//the repository. By default we set it to the connection string name
const string DatabaseName = "Live_Integra";
And dragged in the tt files.
When they run I'm getting the error...
Error 2 Running transformation: System.InvalidOperationException: Sequence contains more than one matching element
at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at Microsoft.VisualStudio.TextTemplating47D0892A160210D689C6B90986A9AE0D.GeneratedTextTransformation.LoadTables() in c:\Programming\UpdateCotswolds\UpdateCotswolds\SQLServer.ttinclude:line 134
at Microsoft.VisualStudio.TextTemplating47D0892A160210D689C6B90986A9AE0D.GeneratedTextTransformation.TransformText() in c:\Programming\UpdateCotswolds\UpdateCotswolds\ActiveRecord.tt:line 23
at Microsoft.VisualStudio.TextTemplating.TransformationRunner.RunTransformation(TemplateProcessingSession session, String source, ITextTemplatingEngineHost host, String& result)
This is the line in question...
var pkColumn=tbl.Columns.SingleOrDefault(x=>x.Name.ToLower().Trim()==tbl.PrimaryKey.ToLower().Trim());
I'm guessing I'm making a silly mistake and hopefully someone can set me straight...
Thanks in advance...
Upvotes: 1
Views: 1003
Reputation: 3221
It appears that a certain table has more than one primary key? Can you post your schema up? Or maybe your PK and FK are names the exact same and SS is getting confused.
Maybe you can play around with the string[] ExcludeTables = new string[]{}; property found under "Settings.ttinclude" until it works and provide the schema for that one table.
Upvotes: 2