Warning: Cannot modify header information - headers already sent by (output started at /home/content/63/11165463/html/index.php:3) in /home/content/63/11165463/html/wp-includes/feed-rss2.php on line 8
JR.Cook.Code() http://jrcook.net Just another .NET developer finding his way in the world of programming Wed, 03 Jan 2018 06:53:57 +0000 en-US hourly 1 https://wordpress.org/?v=4.9.3 http://jrcook.net/wp-content/uploads/2017/06/cropped-D1_2251_x-32x32.jpg JR.Cook.Code() http://jrcook.net 32 32 My Top Video Games of 2017 http://jrcook.net/2018/01/03/my-top-video-games-of-2017/ http://jrcook.net/2018/01/03/my-top-video-games-of-2017/#respond Wed, 03 Jan 2018 06:53:57 +0000 http://jrcook.net/?p=56 2017 was a pretty great year for gaming as what has become one of my favorite consoles of all time has released with the Nintendo Switch. I think a lot of people really underestimated how great this piece of technology was and it had some of the most incredible first party titles ever released in my opinion. I love playing this system on my TV and also taking it with me wherever I travel, the only thing I wish it had was even more titles for it.

With all of that said, I have very specific tastes when it comes to video games and I certainly have not played every game released, nor even all of the most popular ones. I’m not expecting my list to pair up much with others out there who get paid for this kind of content and have more time to play games than I do, but this list is very specific to my own personal likes and what games I have been able to play this year. The only criteria I have on this list is that the game was released in 2017 and it’s one I enjoyed.

#10 Mario Kart 8 Deluxe (Nintendo Switch)

I realize this game originally came out in 2014 for the Wii U, but it was updated a bit for the Nintendo Switch. I played the game much more on the Switch than I ever did with the Wii U and it just flat out ran better, too. Not to mention the game looks fantastic in 1080p as compared to the 720 it was on the Wii U. I rank it as 10 simply because it was a re-release, but one that I spent a lot of time playing this past year.

#9 Horizon Zero Dawn (Playstation 4)

The only RPG on the PS4 this year that I think was worth playing. It would have been pretty high up on the list but then Breath of the Wild was so much better. After playing that it felt like this game just fell into the same pitfalls we’ve seen with previous RPGs over the last decade, but it’s still a solid game.

#8 Mario + Rabbids: Kingdom Battle (Nintendo Switch)

This game was a complete surprise to me. The concept looked dumb. I hate the Rabbids and their stupid games. I also really dislike XCom2 which this game is similarly modeled after. The weird thing is though, they made it all work and the game itself is really fun. It does a good job of capturing Mario games while having pretty difficult encounters that aren’t super punishing like they are in XCom2. The presentation and graphics of the game are also super fun and done really well.

#7 Cuphead (PC, Xbox One)

This is probably some of the best art ever done in a video game by an indie artist and it has the style of the old platform games I really enjoy along with the difficulty level of the old retro games. It also is a really great co-op title as well!

#6 Fortnite (PC)

So this game is a bit of a mixed bag. The single player had some true potential. The gameplay was there and the building mechanic was interesting. However, the pay to win system with loot chests and the endless grind was going to really kill this game. And then another development team came in and built the Battle Royale PVP version of the game and made that completely free to play. This mode has been insanely popular in the community and shows how solid the base mechanics of the game were. It’s still considered early access so hoping they can turn around the PVE mode but if not, they still have done a fantastic job with PVP.

#5 Hearthstone: Kobolds and Catacombs – Dungeon Run (PC, Mobile)

Hearthstone is approaching 3 years old and last year I didn’t include any of their expansions in my top 10 list because I didn’t feel it was fair to include them even though it was one of my most played games that year. However, Kobolds and Catacombs is a little bit different because the Hearthstone team released one of their most ambitious single player modes to date. If you’ve never played Hearthstone before, now is the best time in my opinion to get into the game.

In a world where Reddit is whining that the game is too expensive, they’re completely ignoring how Dungeon Run has become one of the best modes to play the game and is 100% free. You don’t need a collection to play it. You don’t need gold or money to start a new game for it. You just open it and play. The new expansion was only released in early December and I probably already have a solid 50+ hours in Dungeon Run and as a player that played primarily ranked, I haven’t looked back since Dungeon Run came out.

#4 Golf Story (Nintendo Switch)

I’m a sucker for old retro style games, especially ones that are 16/32 bit. I also have a soft spot for goofy little sports titles, especially ones that are more about fun mechanics more than realism. Golf Story definitely did not disappoint and was a ton of fun to play. The characters were funny and the game was light hearted. It was also a little challenging in some spots as well. It’s definitely my little title game of the year.

#3 Friday the 13th the Game (PC, Xbox One)

I’m not a fan at all with the horror genre, much less the slasher/gore genre. I had no interest in this game until some friends convinced me to try it out. Turns out this game is an absolute blast when you play it with a bunch of friends, especially if you happen to all be counselors in the same game against Jason. Some of the most fun I’ve had playing online with friends was in this game – unfortunately, playing it alone with a bunch of random people is just the shit show you would imagine it would be.

#2 Mario Odyssey (Nintendo Switch)

Any other year this would have been my #1 game of the year. This is easily one of, if not the best Mario game that has been created. The sandbox mode and finding all the moons is what makes the game feel like the old style N64 and Mario Sunshine games. The new mechanics they added to the game were fantastic and the graphics and little story were great as well. If there’s anything Nintendo knows how to do, it’s how to make a really solid Mario game.

#1 The Legend of Zelda: Breath of the Wild (Nintendo Switch)

The best Legend of Zelda title to date and the first Zelda title I thoroughly enjoyed since Wind Waker. At first the weapon system was a little jarring with weapons being able to break and you’d have to stop in between a battle to swap out a weapon, but it’s that system that made the game so much fun. The fact that this game was non linear and all about rewarding the player for exploring is what made this game so special. You can play through it multiple times and never feel like you just played the same game again. To me, this was the perfect RPG/Adventure game ever released and it has me really exited about Nintendo’s future if this is what we’re going to start seeing out of them.

]]>
http://jrcook.net/2018/01/03/my-top-video-games-of-2017/feed/ 0
How to Get Bluetooth Headphones to Work with Nintendo Switch http://jrcook.net/2017/06/22/how-to-get-bluetooth-headphones-to-work-with-nintendo-switch/ http://jrcook.net/2017/06/22/how-to-get-bluetooth-headphones-to-work-with-nintendo-switch/#respond Thu, 22 Jun 2017 04:21:01 +0000 http://jrcook.net/?p=45 So before I get started, let me just state that there is no way for the Nintendo Switch to work by itself with bluetooth headphones. Nintendo just doesn’t have the correct drivers in place for some reason, and I’m not sure if they are planning on making this happen at all. This blog post will simply show you a way that you can get it to work without much hassle by buying a few things and I’ve been using this set up for several weeks now and am very happy with it.

Here is the list of items I use:

And of course the headphones I use with it:

The most important piece of all of this is the Bluetooth Transmitter Receiver. You want to make sure it’s small enough to be able to fit on the back of the Nintendo Switch (and the one I listed does, as well as has room so you can dock the Switch) – but most importantly you want to make sure it has LOW LATENCY. There are lots of cheap transmitter receivers out there, however, some of them won’t have low latency. This causes problems when you are gaming because there will be a small lag in the game sound that can throw you off completely. The lower the latency, the less the lag. With the ones I listed, I can’t even tell if there is so it works great.

From there you just have some velcro strips that stick on to the back of the transmitter and the Switch and you can place the transmitter right on the back of the Switch near the headphone jack. And thus, why I bought the ultrashort interconnect cable. It flushes nicely together without excess cables hanging off the Switch and getting in your way. Everything together is so small it doesn’t add any weight to the device at all while I’m playing it and I don’t even notice it’s there – and I can position the transmitter up high enough that I can also easily dock the Switch with it on.

The only real downside to this method other than having to buy this extra gear to get something simple like this working, is that you will need to occasionally charge the Transmitter into a USB port. I hate having another device to charge, but unfortunately it’s the only way to get something like this to work until Nintendo decides to make bluetooth headphones natively work with their system.

As for the headphones I listed, the Bose Q35s are simply the best headphones I have ever owned in my life. I use them daily for work when I am programming and they are completely invaluable when I’m travelling, especially on a plane. When I have them on in a plane, I can’t even hear the plane engine, much less all the crying babies.

Now when I am hanging out at home and having conversations with the family while I’m playing, the Aftershokz bone conductors are my go to headphones. They’re not superior sound quality or anything but they’re cool in the fact that you don’t put them in your ear, they just rest on your temples. That way you can easily hear everything else going on around you. I have a few friends who have used them for gaming in a kind of social setting and know several who use them when they’re outside running and want to also have that alertness of their surroundings.

Both headphones I highly recommend depending on the reasons you need them for.

Anyway, let me know if you have any other tips for getting your bluetooth  headphones to work with the Nintendo Switch wirelessly in the comments, or let me know if this set up also worked for you. Have fun playing!

]]>
http://jrcook.net/2017/06/22/how-to-get-bluetooth-headphones-to-work-with-nintendo-switch/feed/ 0
My Top Video Games of 2016 http://jrcook.net/2017/01/03/my-top-video-games-of-2016/ http://jrcook.net/2017/01/03/my-top-video-games-of-2016/#respond Tue, 03 Jan 2017 02:55:19 +0000 http://jrcook.net/?p=31 I have some good coding stuff coming up in the next week or so (using Websphere MQ with C# as well as wanting to write some about Xamarin and Unity). But with the New Year and the fact that I love to reflect on video games I’ve played, I wanted to put together a little post about my top 10 games of 2016.

Now, I don’t get a chance to play every single game that comes out. I’m also not a reviewer. These games are just ones that I got a chance to play in this last year (that released in 2016) and are ones I would absolutely recommend to friends who are looking for a specific style of game. The only criteria I have is the game was released in 2016 and I enjoyed it.

#10 MLB The Show 16 (PS4)

At this point I’m expecting people to stop reading. What, a sports game is in your TOP TEN!? Yes, it is, because it’s honestly the best sports game in my opinion. I love this series and they keep making it better every year. I really enjoy the card buying/selling/market you can do to build your own team and play against other people. If you love baseball this game is pretty awesome and I’ll always recommend it to someone who is just looking for a solid sports game to play.

#9 Superhot (PC)

I had so much fun playing this game. I only have 3 hours of play time on this game but it was an incredible 3 hours. That was just their little campaign mode – there is more you can do with the game that I hadn’t even attempted yet but really should go back and do. It feels like a puzzle game with a bit of first person shooter style action to it and it’s really fun trying to figure out the baddest ass way of killing the red dudes. I loved dodging their bullets, hitting them, stealing their weapon, and then shooting them with it. And it’s even more incredible to watch it all in real time after you did it.

#8 Faeria (PC)

This game is now free to play and I heard about it because their marketing team emailed us on Well Met and said their devs listen to our Hearthstone podcast and were fans of the show and were curious if we’d like to try out their game. I decided to give it a shot. I honestly wasn’t expecting much, but the game play was actually really fun. It had familiar elements of Hearthstone in it without the very frustrating factor that can sometimes accompany Hearthstone (mostly RNG pushing games or just highly overpowered cards coming out perfectly on curve for your opponent).

The downside is the game has a really steep learning curve to it and much like Hearthstone, doesn’t feel like you get a lot of power until you get some better cards later on. However, with a limited number of cards I was able to rank up to 15 without any real issue (their ranking system is very similar to Hearthstone). Another downside is it doesn’t nearly have the amount of players that Hearthstone has as was apparent when I was playing people at rank 9 and 10 when I was around 18.

If you like digital card games with a bit of built in turn based strategy, this game is definitely for you and is one I want to dive in a bit more on.

#7 Super Mario Run (iOS)

This is one of two mobile games I’m putting on my list. If you know me well, you know my love for mobile games is pretty low. I really don’t play them a lot and have a hard time getting engaged in them. Most mobile games tend to use the “freemium” model where you pay to unlock to play more and all that crap. I hate that model.

Another problem I have with most mobile games is they’re not normally developed by AAA studios. So here comes Nintendo with Super Mario Run. I love Nintendo and I love Mario – I instantly fell in love with this game. The fact that it’s $10 and unlocks everything I need to play it, even better.

It got a lot of flack for being $10 and having to be always online to play – but neither one of those bothered me at all. Other than Pokemon Go, this is probably the most I have ever put time into a mobile game as I’m slowly trying to get all the special coins on all the levels (a little over half way there!)

#6 Stardew Valley (PC)

This is an indie title that when I first saw it, I figured I would immediately hate it. But because a good friend of mine recommended it and said I would like it, I gave it a shot. I immediately fell in love with the graphics and wish more developers would use the old sprites for their games like this. I just love the retro SNES style look. The game itself will provide hundreds of hours very easily and is pretty open world in what you decide you want to do. This is another game I need to go back to and “finish”.

There’s just something special about games like this where the object is to farm, sell your goods, and build up your little housing area.

#5 Job Simulator (PSVR)

The game itself is really nothing special other than being pretty funny. But this is the game I use whenever I introduce someone to virtual reality for the first time. As a virtual reality game, it is pretty awesome to play around with and a lot of fun to watch people try it out for the first time.

VR is still one of those things that I don’t feel is even remotely close to being fully explored yet for gaming as everything released really feels more like a demo than anything. Job Simulator also feels kind of that way as well, but the environments are fun for people of all ages and really teaches people how to look around, grab a hold of stuff, and interact with their environments in a way that was really never possible before.

I’m really excited to see what will happen with VR in the future now that consumer viable systems are finally available. I love my PSVR and it excites me enough that I’ve been exploring how to develop for it myself.

#4 Overcooked (PS4)

This game could have very easily been my #1. I wanted a co-op game my wife and I could play on the couch together that wasn’t Diablo 3 and this game more than delivered. It was some of the most fun we’ve had outside of playing WoW and Minecraft together in gaming.

The game is very simple but the challenges can also be quite challenging. The game is very puzzle like but requires a LOT of communication between you and your teammates to complete the challenges. We’ve found that even talking through how we’d approach certain levels after getting beat helped a lot, too.

However, it’s not all fun and games. The game can be very aggravating and you might find you yelling at or getting yelled at as you try and work together through the obstacles. But if you’re able to successfully handle that without it getting out of hand, I very highly recommend this game – especially for the price!

#3 Final Fantasy XV (PS4)

Final Fantasy VI has been by far my favorite Final Fantasy game of all time. Runners up to that have been the original Final Fantasy for NES and Final Fantasy VII. The last Final Fantasy I really enjoyed (but never finished) was Final Fantasy X.

I haven’t been overly happy with the series as of late though. I disliked the combat in XII and XIII was just flat out awful. I’ve also had no interest in the MMOs. From seeing XV and how combat worked, I thought I was going to be highly disappointed again.

With that said, I still absolutely hate the combat in FFXV. It’s terrible – the magic system is awful and I’ve been unimpressed with how summoning works. But most of all, I just really hate the combat and wish they would go back to the turn based system that made me love the genre.

However, this is still #3 on my list and is easily my favorite Final Fantasy since VII. In fact, if the combat system was even remotely decent I’d rank it above VII. I love the storyline – I love the world. I love exploring the world and all the little side quests. The characters are all great and I love the little skills they get. The game is just everything I want in a Final Fantasy game… if they would have just done the combat right.

#2 Pokemon Go (iOS, Android)

This is another mobile game on my list and one I no longer play. However, this summer when it came out, the hype was very real. There were times my wife and I would seek out pokestops and gyms on our trips and sit and play for a while. At DragonCon there was 3 pokestops in our hotel and we’d just sit and play what felt like the entire trip.

The effect the game had on the real world was unlike anything we have ever seen before. The game would flat out be amazing if it was built like an actual Pokemon game or had any kind of real gameplay to it other than catching and hatching Pokemon. The battles and the gym system were just straight up awful and if this was a DS game for Nintendo the Pokemon genre would have died it was so bad. However, Augmented Reality feels like the future of mobile game and this is a huge step in the right direction – and because of the popularity of the game and how it affected the real world, it has to be my #2 just because of it’s impact alone.

#1 Overwatch

This one actually really surprised me. I love Blizzard games. Overwatch seemed interesting, but didn’t seem like my kind of game. I don’t play a lot of FPS games and I don’t really enjoy the community surrounding them. I knew I’d play it just for the simple fact that I would be writing about it here and there on BlizzPro – but I didn’t think I’d actually like it – nor did I think I would love it as much as I did.

For a game that doesn’t even have a single player mode, I have hundreds of hours already invested. I love how different all the characters feel. I love the way the game feels and the different strategies. Even when I’m losing (which happens often because I’m old) I still have a blast playing the game. Best of all, the development team has been one of the most responsive I have ever seen from Blizzard and they just keep increasing the bar every couple months. I feel like Overwatch has a lot more to come in 2017 and beyond and it’s easily become one of my favorite games of 2016 and I’d even rank it in my top 10 games of all time right now. That’s how good it is.

Honorable Mentions

So these 2 games I would place in my top 10, but they’re really more expansions than new games. Those would have to be WoW: Legion and the 3 different expansions for Hearthstone that were released this year. Legion easily has WoW in one of the best places it has ever been. Even though I don’t nearly play it as much as I used to, the game is just really solid right now with new content rolling out at a really good pace, something the game has suffered from in the past.

As for Hearthstone, with the release of Whispers of the Old Gods we saw the introduction to the standard format and rotation of sets out of the format each year. This is still the game I play the most of, write about the most, and even do a podcast about – so it would be silly if I didn’t at least mention it!

Games That Could Be Here

Like I said, I didn’t get a chance to play every game of 2016, or even some that I have been interested in but haven’t purchased or have had the time to play. These are very likely to have been in this list if I ever get a chance to play them:

  • Uncharted 4
  • Dark Souls 3
  • Inside
  • Last Guardian (got this for Christmas but haven’t had a chance to play yet!)
  • Battlefield 1
]]>
http://jrcook.net/2017/01/03/my-top-video-games-of-2016/feed/ 0
Making the World Connect Again http://jrcook.net/2016/11/11/making-the-world-connect-again/ http://jrcook.net/2016/11/11/making-the-world-connect-again/#respond Fri, 11 Nov 2016 22:55:20 +0000 http://jrcook.net/?p=25 So I made this little blog to write about coding and software development in general. I actually have a few blog posts I’ve been putting together that I’ll have out soon. One on using SqlBuilder with Dapper to dynamically create your SQL, some on Xamarin as I’m attending their Dev Days tomorrow in Kansas City, and even one on consuming IBM MQ Series with a service.

However, since I got back from BlizzCon this past week which produced an incredible high for me, and then the election on Tuesday that produced an incredible low for me – it’s been difficult for me to be motivated to do too much outside of work just because exhaustion has set in.

And when that happens, I start to think about things – such as the state of the world we live in right now. I got to meet so many great people at BlizzCon this last week – people that read my articles or listen to my podcast. People that love what we’ve put together over at BlizzPro.com and just people who love the games and community in general. Being able to connect on that level and have something in common is very important for us as people. This is something social media has tried to solve in the past, but more recently it’s become so much noise that it’s really become a platform where you can choose who you don’t want to listen to, you can cut yourself off in your own echo chamber, or you can spend the time arguing over every little thing without listening to what the other person is even trying to say.

And because of that, I feel like even though the world is way more connected right now than it has ever been in existence, that it’s dividing us even more and we don’t connect on a human level as much as we used to.

So I’ve put some time in thinking how I can help fix that and had a bit of a silly idea.

As you may know if you’ve read my about page, I work at Hallmark Cards as a software developer. I really love where I work because it’s the first place I’ve worked where the business not only cares very deeply about it’s employees, but it’s whole existence of a business is built around the idea of creating those little connections with one another. One of the simplest ways you can do that is by telling someone you are thinking of them or that you care about them – and it’s as simple as sending a little greeting card with a note in it to let them know. It’s an art that has been very much replaced in the internet age by an email or a Facebook message to someone.

So, with that said – to my friends on social media – on Facebook or twitter, to friends and family who know me in person that may be reading this, to readers of my website or listeners of my podcast – I have something to ask of you. Simply send me your address, either email me jr@jrcook.net, DM me on Twitter, Facebook, wherever. Just send me your address.

This holiday season I plan on sending out greeting cards to you all. If you’re feeling down about anything, election, life in general, or just need a simple pick me up, it doesn’t matter. It doesn’t matter if we’ve never met, never talked before, or you just found this randomly somehow.

If you send me your address you will get a greeting card and a personalized note from me in the mail that I hope will at least lift your spirits for a bit.

PS – I would like to note that even though I work at Hallmark, this has nothing to do with them. It’s my own personal doing and they don’t even know (yet) that I’m even doing this. So it’s no way sponsored by them at all.

]]>
http://jrcook.net/2016/11/11/making-the-world-connect-again/feed/ 0
Using Dapper with DB2 http://jrcook.net/2016/10/24/using-dapper-with-db2/ http://jrcook.net/2016/10/24/using-dapper-with-db2/#respond Mon, 24 Oct 2016 00:06:53 +0000 http://jrcook.net/?p=12 I know the new hotness is development is always looking for Greenfield projects and building out your new applications using the new technology and building out your database using Code First with Entity Framework.

However, life in the development world isn’t all green fields and puppies and you’re finding yourself having to use legacy systems for one reason or another. I’ve found myself in that position in needing to interact with a legacy DB2 database and create a Web API in order to create some services that can produce and consume that data.

In the past we’ve used a powerful ORM tool like Entity Framework to do our CRUD operations to the DB2 database. We definitely had a lot of pain points in using EF, most importantly speed and performance being the culprit. It was so bad that there were times we ended up just resorting to ADO.NET. Yes, it was messier code and tougher to unit test, but it was also incredibly faster.

Due to this, on a Web API I was creating, I decided to do some research on other ORMs and came across the Micro ORM that Stack Overflow created called Dapper. Dapper promised speed close to ADO.NET while also providing extensions for your IDbConnection interface. Upon using this I was blown away by the speed and also how simple it was to set up.

Let me walk you through a quick and simple repository and in some future blogs I will show how I implemented the Web API portion using other nuget packages like Automapper and Fluentvalidation.

The first thing you will need to do is download and install the ODBC and CLI client DB2 drivers from IBM. More information on that here.

In your newly created .NET project you will then add a reference and browse to the location of IBM.Data.DB2.dll and add that as a reference. This is what will allow you to now use DB2Connection extensions. The DLL is most commonly found in this location if you did a non custom install for 64 bit or (x86) for 32 bit — C:\Program Files\IBM\IBM DATA SERVER DRIVER\bin\netf40

The next thing you will want to do is add the Dapper reference using Nuget Package Manager. This is quite simple to do. Just go to your Package Manager Console and type in the following: Install-Package Dapper

This should quickly install Dapper as a reference to your project and you are ready to begin coding. Now I don’t want to get into dependency injection or unit testing with this example — but you should totally use it and fully unit test your code, those examples will be for another day.

The first thing I want to do is create my model. This is how my database table will look like that I want to do CRUD operations with. For example purposes I made a very simple EmployeeModel that has an id, First Name, Last Name, and City.

The EmployeeModel

The second thing I do is create a very simple Interface for my repository. I want to be able to Find by Id, Get all records, Retrieve, Add, Update, and Delete. I’m going to show Find by Id, Get All, Add, and Delete in this example. For Retrieve and Update I use something called Dapper.SqlBuilder and I’d like to discuss that alone in a future blog.

My Interface I will be using for EmployeeRepository

And finally I will create an EmployeeRepository class that will implement the interface I just created. I will also go ahead and set up my IDbConnection using DB2Connection and reference my connection string that I have in my web.config. This is where normally you would want to start using Dependency Injection so you can create mocks of your code for unit testing purposes — but for ease of setting up I will by pass that.

A blank repo implementing my interface

The first method we’ll do is GetAll, it’s really simple. All we want to do is run a Query using our EmployeeModel, return all records in a list. It’s a very simple SQL statement.

This will return a list of EmployeeModel from DB2

The second method we will implement is FindById. In this case we are passing in an integer and we want to return 1 record from our Employee table. You’ll notice the SQL in this case I am using @ID as it is very important that you parameter your SQL to defend against injection attacks. In this case it knows that id is what is being passed on, I’m using it as a parameter and using an anonymous object to assign my EmployeeModel Id to the variable id being passed in.

This will then return the record in the database where the Id equals what we passed in.

Always use parameters in your SQL!

The third method I want to show is delete. It’s also very simple and works much the same way we saw in the last 2 examples. In real life I hardly ever use delete as a method in my APIs and would likely want to return something if I did, like a message or something to that effect. However, for example sake I went with a very easy void method.

The main difference is we don’t have to do a query here, we can just straight up execute our SQL. Remember to use a parameter!

And for the final method I want to show today is our Add method. This one gets to be a little more complex because what I want to do is add the record, and then return the record I just created back.

Remember that in this case Id is an autonumber that is created by the database when a record is created. It’s a unique identifier that will not be passed in through the method. With SQL Server you can just use @SCOPE_IDENTITY to accomplish this but DB2 is a bit more rusty with how to do it.

Instead we want to select the Id from the FINAL TABLE of the INSERT statement we do. Once we get the id that was just created we can run a query on that table, add it back to the model we passed in, and return it back.

Seriously, good luck finding any other place on the internet that describes this, I tried. One of our DBAs was able to figure out a method for me that worked without making a second trip to the database.

NOTE: There is something in DB2 called “IDENTITY_VAL_LOCAL” but I’m not sure if that solely works with DB2 for Linux/Unix/Windows – I was unable to get it to work with Z/OS.

And that should do it! We still have Retrieve and Update to accomplish but those will be for my next blog as I explain how to use Dapper.SqlBuilder for those. After that I will show you how to wrap this all up in a Web API.

This is my first ever post I have made about programming, so if you liked it please let me know. It won’t be perfect so if you have any suggestions for improvements I would love to hear that as well. You can do so here or hit me up on Twitter.

Good luck and happy coding!

]]>
http://jrcook.net/2016/10/24/using-dapper-with-db2/feed/ 0