In this article I’m going to take you through the steps for using Amazon RDS with Entity Framework code first. I will not be covering any details related to Entity Framework. First you need to install AWS Tools for .NET. Then you will need to open up the AWS explorer from visual Studio View menu. Remember you need to have your account setup with Amazon Web Services. From this you can manipulate your AWS account.
So first I am going to create a database using the AWS RDS. Here I will be selecting the Amazon RDS (Relational Database Services).
For some R&D work related to Entity Framework and MySQL I installed MySQL on windows 7. I couldn’t work on this for some time, so naturally I forgot the password. So I thought to reinstall it. So I uninstalled it and try to install it again. The installation was successful but the configuration wizard was not responding for hours.
So I googled for it and found the solution, but it was not the exact answer to my problem. There were very complex solutions as well. Following are the steps that O followed.
1. Completely uninstall MySQL
2. Remove the MySQL folder under the hidden folder “ProgramData”
3. Remove the MySQL folder under the “ProgramFiles”
One of the solutions required to restart the computer after going through the above steps, but I didn’t restarted the computer. Then I tried again with the installation, and the installation went fine.
The issue behind this is, when you uninstall MySQL it will not remove all the files and these files are in an inconsistent state after uninstallation. During the installation the configuration wizard will access these files and try to modify them. Due to the current state of these files the configuration wizard can’t alter any of these files and the wizard will go to “Not Responding” state.
When we design for distributed systems logging is one of the important thing that we need to consider. Why is it so important? As we all know, when we take a distributed system there are many layers involved and also many third party integrations such as facebook, twitter, payment gateways, etc. All these component together may build your enterprise solution.
So the problem arises when it comes to locate issues within your system. The business needs are changing and new competitors comes up all around the world and no one can rest, sometimes you may get requirements to be implemented over night. So these requirements need to be implemented and deployed to the target users as quickly as possible and we can’t afford to have bugs in these releases as they will end up with catastrophic results to the end users.
Debugging would be an ideal and the apparent solution for this, but believe me if you have several different layers in your solution and some third party integrations, it is not. Because you’ll have to spend hours to locate the locations to put the break points and have to run the debugger several times to identify the issue. This is like brain surgery hard scenario and you can’t spend time one these. And if you have any asynchronous processing and any threads involved, identifying an issue will be more difficult than anything else.
As I have been working with TFS2010 build automation for past few days, again I came across a dead end. The issue was all our application servers are on Amazon EC2 and the backend is on Amazon RDS. This was new to me and I had to include the script which contains the database changes to the Build Automation. i.e. The Build will execute the script from the Build server against the RDS instance. When it comes to RDS there are no servers or you can RDP to it. It is nothing but a standard database instance. So I thought of going through a step by step approach on solving this.
First followed a fundamental video tutorial on Pluralsite and got the basic understanding of the Amazon RDS for SQL Server. After that I have posted the question on AWS RDS forum. In the mean time we have also contacted the AWS support and according to the support person I could execute scripts remotely against the RDS instance using the “Sqlcmd”. So my preference was to do it via Powershell. So I did some R&D and found this excellent article which helped me to solve my issue.
The equivalent of the “SqlCmd” in powershell is “Invoke-Sqlcmd” command. This is not installed on your system by default. If you are using sql 2012, this will be installed with SQLPS modules. Follow up the document bellow on the Simple-Talk, it explains everything in detail.
Practical PowerShell for SQL Server Developers and DBAs
After doing the configuration I have used the following command to connect to the RDS instance remotely. Following example just uses a select statement.
PS C:\Users\Administrator> Invoke-Sqlcmd –ServerInstance -Database EmployeeData –Query “Select * from HoursWorked” –Username -Password
Please follow the link for more detail on “Invoke-Command”.
I have been implementing TFS 2010 automated build for our company’ product and initially it was implemented in a workgroup environment. There were some custom Powershell scripts that has to be executed remotely and it took weeks for me to finally solve it.
I was so close to complete the whole automated process but due to the security factors we have to bring in a Domain Controller and had to add the servers to the domain. All our servers are in Amazon Cloud and during this process the computer names were changed and all the share point configurations and the TFS configurations were somewhat corrupted. So instead of battling with the trouble shooting this I decided to remove TFS and re install it.
So I did a basic installation as a standalone server and all the settings were fine. But after setting the build definition and queue a new build, I faced a whole new problem as follows. No matter what I did everything failed at the Get Workspace step as follows.
Attempt by method ‘Microsoft.TeamFoundation.Build.Workflow.Activities.TfUndo+TfUndoCore.RunCommand(Microsoft.TeamFoundation.Build.Workflow.Activities.VersionControlScope, Microsoft.TeamFoundation.VersionControl.Client.Workspace, System.String, System.String)’ to access method ‘Microsoft.TeamFoundation.VersionControl.Client.Workspace.Undo(Microsoft.TeamFoundation.VersionControl.Client.ItemSpec, Boolean, Boolean, System.String)’ failed.
I was trying many things and everything failed. But at the end my good old friend, Prabath helped me out by suggesting that I should install the TFS 2010 service pack 1. But I have already done that.
So I was out of options, and then I decided to re install the service packs. First I installed the Microsoft Team Foundation Server 2010, Service pack 1 using the following link: TFS 2010 Service Pack 1
After that I applied the Cumulative Update package 2 for Visual Studio Team foundation server 2010 Service Pack 1 from the following link: Cumulative Update package 2 for Visual Studio Team foundation server 2010 Service Pack 1
So this approach solved the issue for me which I was stuck in the above issue for 4 days and have to say that never give up. There is always an answer and always someone to guide you to get it fixed.
During the last week I have been working on one of the payment gateway implementation for the current project that I’m working. For this particular payment gateway, it accepts web request as serialized XML. Also it sends the response back to us as XML and we need to deserialize it.
The serialization was already implemented in one of the XML helper class in the solution. I only have to pass the object to get is serialized. After implementing this I have started to test it and all the test were failing. I had to spend painfully longer hours to understand what is exactly going on.
I found the issue by comparing the system generated XML request and the sample request sent from the support and also with the sample request on API documentation. The issue was there are some unnecessary XML namespaces in the root element and the payment gateway can’t process the root element with the namespaces.
This article is about to get a good understanding of how an IOC containers works. In real life you don’t have to create IOC containers by yourself as there are many frameworks that can be used, such as Unity, Castle Windsor, Ninject etc. But as a developer understanding the mechanics of this is important.
First we’ll have a look at what is as IOC container is and how it can resolve dependencies. As an example I will be demonstrating the constructor injection.
In basic terms we can think of an IOC container as a framework for implementing dependency injection. This is the fundamental purpose of the IOC container. Apart from that it can manage the lifetime of an object, but here our focus is on the primary feature, i.e. to do the Dependency Injection automatically once we configured it. In the configuration you configure the dependencies so if you have an interface and when you ask for it the configuration will resolve it to the particular concrete type. Also you can use this concrete type to resolve to another type down the class hierarchy. The key concept here is you set up the dependencies and the container will automatically resolve it for you.
So if you ask for IPerson interface and the IOC container will resolve it to an Employee or Student concrete types. In this case any of the scenarios doesn’t know about the dependencies, only the IOC container knows about the dependencies.
Following is a high level visualisation of the implementation of the IOC container.