コード例 #1
0
ファイル: Examples.cs プロジェクト: wolfester/Sequelocity.NET
        public void AddParameter_Example_Providing_A_DbParameter()
        {
            DatabaseCommand databaseCommand = Sequelocity.GetDatabaseCommand(ConnectionStringsNames.SqlServerConnectionString);

            var dbParameter = databaseCommand.DbCommand.CreateParameter();

            dbParameter.ParameterName = "SuperHeroName";
            dbParameter.Value         = "Superman";
            dbParameter.Direction     = ParameterDirection.InputOutput;

            List <SuperHero> superHeroes = databaseCommand
                                           .SetCommandText("SELECT * FROM SuperHero WHERE SuperHeroName = @SuperHeroName")
                                           .AddParameter(dbParameter)
                                           .ExecuteToList <SuperHero>();
        }