You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

tabledependency

Package Overview
Dependencies
Maintainers
0
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

tabledependency

2.0.1
unpublished
nugetNuGet
Maintainers
0
Source

============================================================== TableDependency Nuget Package Version 2.0.1.0 README

Release 2.0.1.0 for SqlTableDependency June 2015 Copyright (c) Christian Del Bianco 2015

This document provides information about SqlTableDependency.

TABLE OF CONTENTS *Fixed Bugs Since Last 2.0.0.0 NuGet Release

Fixed Bugs Since Last 2.0.0.0 NuGet Release

  • Fix bug about wrong usage of TableDependency.Mappers.ModelToTableMapper.

=========================================================================== TableDependency Version 2.0.0.0

TABLE OF CONTENTS

  • New Features
  • Fixed Bugs Since Last 1.0.1.2 NuGet Release

New Features

  • C# Model to database columns Mapper The TableDependency.Mappers.ModelToTableMapper decouple the properties name in C# model with table columns name. Given this database table:

CREATE TABLE [dbo].[Customer] ( [Identifier] [int] IDENTITY(1,1) NOT NULL, [First Name] nvarchar NOT NULL, [Second Name] nvarchar NOT NULL)

And this model:

public class Customer
{
    public int Id { get; set; }
    public string Name { get; set; }
    public string Surname { get; set; }

    // Column not present in Customer database table, so it will not be left empty
    public string City { get; set; }
}

It is possible to map in the following way:

string ConnectionString = "data source=.;initial catalog=TableDependencyDB;integrated security=True";

var mapper = new ModelToTableMapper<Customer>();
mapper.AddMapping(c => c.Name, "First Name").AddMapping(c => c.Surname, "Second Name");

var tableDependency = new SqlTableDependency<Customer>(
    ConnectionString, 
    "customer", 
    modelToColumnsTableMapper: mapper);

2. Columns to monitor for SQL update It is possible to specify a list of table columns that, when modified, will trigger an event C# side. Doing that, you can filter the notification received for changed in table:

string ConnectionString = "data source=.;initial catalog=TableDependencyDB;integrated security=True";
string TableName = "Customer";   

var tableDependency = new SqlTableDependency<Customer>(
    ConnectionString, 
    TableName, 
    columnsToMonitorDuringUpdate: new List<string>() { "second name" }))

tableDependency.OnChanged += TableDependency_Changed;
tableDependency.Start();

Now you will receive notification about UPDATE operation performed on table Customer only when the [Second Name] colomn has been modified.

  • OnError event Every error raise during the listening stage, it is notified to client with that event:

    static void Main() { var mapper = new ModelToTableMapper(); mapper.AddMapping(c => c.Name, "First Name").AddMapping(c => c.Surname, "Second Name");

         using (var tableDependency = new SqlTableDependency<Customer>(ConnectionString, TableName)
         {
             tableDependency.OnChanged += TableDependency_Changed;
             tableDependency.OnError += TableDependency_OnError;
    
             tableDependency.Start();
             Console.WriteLine("Waiting for receiving notifications: change some records in the table...");
             Console.WriteLine("Press a key to exit");
             Console.ReadKey();
             tableDependency.Stop();
         }
     }
    
     static void TableDependency_OnError(object sender, ErrorEventArgs e)
     {
         Exception ex = e.Error;
     }
    

Fixed Bugs Since Last 1.0.1.2 NuGet Release

This section list bugs that have been fixed since the last NuGet release.

BUG https://sqltabledependency.codeplex.com/workitem/1 Fixed with the case insensitive matching between model property name and database table column name.

=========================================================================== Documentation

Documentation available at https://sqltabledependency.codeplex.com/

Keywords

SQL

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts