Hi Guys
Ive been using subcommander to generate my dal. Im using vb.net and sqlexpress and .net 3.5
My webconfig looks like this
<!-- add subsonic in for dal-->
<section name="SubSonicService" type="SubSonic.SubSonicSection, SubSonic" allowDefinition="MachineToApplication" requirePermission="false"/>
</configSections>
<connectionStrings>
<!-- Development connection string -->
<add name="kimconnection" connectionString="Data Source=7NQ384J\SQLExpress;Initial Catalog=kim2;Integrated Security=True;"/>
</connectionStrings>
<!--Add my provider for subsonic to my database-->
<SubSonicService defaultProvider="kimAppProvider">
<providers>
<clear/>
<add name="kimAppProvider" type="SubSonic.SqlDataProvider, SubSonic" connectionStringName="kimconnection" generatedNamespace="kimdata"/>
</providers>
</SubSonicService>
<appSettings>
<!--Add my provider for generating my dal / classes-->
<buildProviders>
<add extension=".abp" type="SubSonic.BuildProvider, SubSonic"/>
</buildProviders>
Ok my problem is that if I comment out my build provider (as I thought I didnt use it when using subcommander to generate my classes), I cant do imports kimdata inside my aspx code behinds to access to classes.
However if I leave this is, (ie dont comment it out) and I then debug my code in visual studio I get over 200 errors, the error message is "statement cannot appear outside method body"
the error seems to show this im my compiled app_code when its debugging, the thing is this is c#, im using vb, the classes I generate are vb, and the default language is vb, so why is this in c# and is this the reason im getting the errors? or is there some other reason, and how can I resolve this as my app wont run as there are to many erorrs,
#ExternalChecksum("d:\dscott\windows\Visual Studio 2008\WebSites\KimV2\App_Code\builder.abp","{406ea660-64cf-4c82-b6f0-42d48172a799}","ECAA88F7FA0BF610A5A26CF545DCD3AA")
using System;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Xml;
using System.Xml.Serialization;
using SubSonic;
using SubSonic.Utilities;
namespace kimdata
{
/// <summary>
/// Strongly-typed collection for the AlertMessage class.
/// </summary>
[Serializable]
public partial class AlertMessageCollection : ActiveList<AlertMessage, AlertMessageCollection>
{
public AlertMessageCollection() {}
/// <summary>
/// Filters an existing collection based on the set criteria. This is an in-memory filter
/// Thanks to developingchris for this!
/// </summary>
/// <returns>AlertMessageCollection</returns>
public AlertMessageCollection Filter()
{
for (int i = this.Count - 1; i > -1; i--)
{
AlertMessage o = this[i];
foreach (SubSonic.Where w in this.wheres)
{
bool remove = false;
System.Reflection.PropertyInfo pi = o.GetType().GetProperty(w.ColumnName);
if (pi.CanRead)
{
object val = pi.GetValue(o, null);
switch (w.Comparison)
{
case SubSonic.Comparison.Equals:
if (!val.Equals(w.ParameterValue))
{
remove = true;
}
break;
}
}
if (remove)
{
this.Remove(o);
break;
}
}
}
return this;
}
}
/// <summary>
/// This is an ActiveRecord class which wraps the alertMessages table.
/// </summary>
[Serializable]
public partial class AlertMessage : ActiveRecord<AlertMessage>, IActiveRecord
{
#region .ctors and Default Settings
public AlertMessage()
{
SetSQLProps();
InitSetDefaults();
MarkNew();
}
private void InitSetDefaults() { SetDefaults(); }
public AlertMessage(bool useDatabaseDefaults)
{
SetSQLProps();
if(useDatabaseDefaults)
ForceDefaults();
MarkNew();
}
public AlertMessage(object keyID)
{
SetSQLProps();
InitSetDefaults();
LoadByKey(keyID);
}
public AlertMessage(string columnName, object columnValue)
{
SetSQLProps();
InitSetDefaults();
LoadByParam(columnName,columnValue);
}
protected static void SetSQLProps() { GetTableSchema(); }
#endregion
#region Schema and Query Accessor
public static Query CreateQuery() { return new Query(Schema); }
public static TableSchema.Table Schema
{
get
{
if (BaseSchema == null)
SetSQLProps();
return BaseSchema;
}
}
private static void GetTableSchema()
{
if(!IsSchemaInitialized)
{
//Schema declaration
TableSchema.Table schema = new TableSchema.Table("alertMessages", TableType.Table, DataService.GetInstance("kimAppProvider"));
schema.Columns = new TableSchema.TableColumnCollection();
schema.SchemaName = @"dbo";
//columns
TableSchema.TableColumn colvarMessageID = new TableSchema.TableColumn(schema);
colvarMessageID.ColumnName = "messageID";
colvarMessageID.DataType = DbType.Int32;
colvarMessageID.MaxLength = 0;
colvarMessageID.AutoIncrement = true;
colvarMessageID.IsNullable = false;
colvarMessageID.IsPrimaryKey = true;
colvarMessageID.IsForeignKey = false;
colvarMessageID.IsReadOnly = false;
colvarMessageID.DefaultSetting = @"";
colvarMessageID.ForeignKeyTableName = "";
schema.Columns.Add(colvarMessageID);
TableSchema.TableColumn colvarDocumentType = new TableSchema.TableColumn(schema);
colvarDocumentType.ColumnName = "documentType";
colvarDocumentType.DataType = DbType.AnsiString;
colvarDocumentType.MaxLength = 50;
colvarDocumentType.AutoIncrement = false;
colvarDocumentType.IsNullable = false;
colvarDocumentType.IsPrimaryKey = false;
colvarDocumentType.IsForeignKey = false;
colvarDocumentType.IsReadOnly = false;
colvarDocumentType.DefaultSetting = @"";
colvarDocumentType.ForeignKeyTableName = "";
schema.Columns.Add(colvarDocumentType);
TableSchema.TableColumn colvarMessageTitle = new TableSchema.TableColumn(schema);
colvarMessageTitle.ColumnName = "messageTitle";
colvarMessageTitle.DataType = DbType.AnsiString;
colvarMessageTitle.MaxLength = 200;
colvarMessageTitle.AutoIncrement = false;
colvarMessageTitle.IsNullable = false;
colvarMessageTitle.IsPrimaryKey = false;
colvarMessageTitle.IsForeignKey = false;
colvarMessageTitle.IsReadOnly = false;
colvarMessageTitle.DefaultSetting = @"";
colvarMessageTitle.ForeignKeyTableName = "";
schema.Columns.Add(colvarMessageTitle);
TableSchema.TableColumn colvarMsgPublishDate = new TableSchema.TableColumn(schema);
colvarMsgPublishDate.ColumnName = "msgPublishDate";
colvarMsgPublishDate.DataType = DbType.DateTime;
colvarMsgPublishDate.MaxLength = 0;
colvarMsgPublishDate.AutoIncrement = false;
colvarMsgPublishDate.IsNullable = false;
colvarMsgPublishDate.IsPrimaryKey = false;
colvarMsgPublishDate.IsForeignKey = false;
colvarMsgPublishDate.IsReadOnly = false;
colvarMsgPublishDate.DefaultSetting = @"";
colvarMsgPublishDate.ForeignKeyTableName = "";
schema.Columns.Add(colvarMsgPublishDate);
TableSchema.TableColumn colvarXml = new TableSchema.TableColumn(schema);
colvarXml.ColumnName = "xml";
colvarXml.DataType = DbType.String;
colvarXml.MaxLength = 1073741823;
colvarXml.AutoIncrement = false;
colvarXml.IsNullable = false;
colvarXml.IsPrimaryKey = false;
colvarXml.IsForeignKey = false;
colvarXml.IsReadOnly = false;
colvarXml.DefaultSetting = @"";
colvarXml.ForeignKeyTableName = "";
schema.Columns.Add(colvarXml);
TableSchema.TableColumn colvarCreatedOn = new TableSchema.TableColumn(schema);
colvarCreatedOn.ColumnName = "createdOn";
colvarCreatedOn.DataType = DbType.DateTime;
colvarCreatedOn.MaxLength = 0;
colvarCreatedOn.AutoIncrement = false;
colvarCreatedOn.IsNullable = false;
colvarCreatedOn.IsPrimaryKey = false;
colvarCreatedOn.IsForeignKey = false;
colvarCreatedOn.IsReadOnly = false;
colvarCreatedOn.DefaultSetting = @"";
colvarCreatedOn.ForeignKeyTableName = "";
schema.Columns.Add(colvarCreatedOn);
TableSchema.TableColumn colvarCreatedBy = new TableSchema.TableColumn(schema);
colvarCreatedBy.ColumnName = "createdBy";
colvarCreatedBy.DataType = DbType.String;
colvarCreatedBy.MaxLength = 50;
colvarCreatedBy.AutoIncrement = false;
colvarCreatedBy.IsNullable = false;
colvarCreatedBy.IsPrimaryKey = false;
colvarCreatedBy.IsForeignKey = false;
colvarCreatedBy.IsReadOnly = false;
colvarCreatedBy.DefaultSetting = @"";
colvarCreatedBy.ForeignKeyTableName = "";
schema.Columns.Add(colvarCreatedBy);
TableSchema.TableColumn colvarModifiedOn = new TableSchema.TableColumn(schema);
colvarModifiedOn.ColumnName = "modifiedOn";
colvarModifiedOn.DataType = DbType.DateTime;
colvarModifiedOn.MaxLength = 0;
colvarModifiedOn.AutoIncrement = false;
colvarModifiedOn.IsNullable = true;
colvarModifiedOn.IsPrimaryKey = false;
colvarModifiedOn.IsForeignKey = false;
colvarModifiedOn.IsReadOnly = false;
colvarModifiedOn.DefaultSetting = @"";
colvarModifiedOn.ForeignKeyTableName = "";
schema.Columns.Add(colvarModifiedOn);
TableSchema.TableColumn colvarModifiedBy = new TableSchema.TableColumn(schema);
colvarModifiedBy.ColumnName = "modifiedBy";
colvarModifiedBy.DataType = DbType.String;
colvarModifiedBy.MaxLength = 50;
colvarModifiedBy.AutoIncrement = false;
colvarModifiedBy.IsNullable = true;
colvarModifiedBy.IsPrimaryKey = false;
colvarModifiedBy.IsForeignKey = false;
colvarModifiedBy.IsReadOnly = false;
colvarModifiedBy.DefaultSetting = @"";
colvarModifiedBy.ForeignKeyTableName = "";
schema.Columns.Add(colvarModifiedBy);
BaseSchema = schema;
//add this schema to the provider
//so we can query it later
DataService.Providers["kimAppProvider"].AddSchema("alertMessages",schema);
}
}
#endregion
#region Props
PK Collections
#endregion
#region Deep Save
#endregion
}
}
Any help or advice greatly appreciated.
Dan