Thursday, June 26, 2008

Testing SyntaxHighlighter

This post is to check that I've setup SyntaxHighlighter correctly.

	public class CustomServerProvider : DbServerSyncProvider
{
public CustomServerProvider()
{
var cnn = new SqlConnection( Properties.Settings.Default.ServerConnectionString );
Connection = cnn;

const string newAnchorVariable = "@" + SyncSession.SyncNewReceivedAnchor;
var selectNewAnchorCommand = new SqlCommand
{
CommandText =
string.Format( "SELECT {0} = min_active_rowversion() - 1",
newAnchorVariable ),
Connection = cnn
};
selectNewAnchorCommand.Parameters.Add( newAnchorVariable, SqlDbType.Timestamp ).Direction = ParameterDirection.Output;
this.SelectNewAnchorCommand = selectNewAnchorCommand;

var downloadOnlyTables = new Dictionary { { "BillingInfo", "BillingInfoID" }, { "Employees", "EmployeeID" }, { "Projects", "ProjectID" } };

foreach( var pair in downloadOnlyTables )
{
var tableName = pair.Key;
var primaryKey = pair.Value;

var builder = new SqlSyncAdapterBuilder( cnn )
{
TableName = tableName,
RowGuidColumn = primaryKey,
SyncDirection = SyncDirection.DownloadOnly,
CreationTrackingColumn = "CreateVersion",
CreationOriginatorIdColumn = "CreateID",
UpdateTrackingColumn = "UpdateVersion",
UpdateOriginatorIdColumn = "UpdateID"
};

SyncAdapter adapter = builder.ToSyncAdapter();
adapter.TableName = tableName;
this.SyncAdapters.Add( adapter );
}

this.SyncAdapters.Add( TimeEntriesAdapter.GetNew( cnn ) );
}


So, there's still some tweaking needed it seems, but it's looking good, perhaps I just need to create a tool to make the code HTML safe, and perhaps wrap it in the right PRE tag for me... something to think about for later



new Dictionary

vs

new Dictionary<string , string>

No comments: