Tuesday, April 17, 2018

Comparing Two Complex Objects in C#


Often, developers encounter a common problem of comparing two complex objects or classes created in code. Most of the time, developers prefer to use the IEquatable approach to actually create an IComparer so that he can define what determines that two of your objects are equal.

But, it's difficult to compare objects that contain nested elements. An objects comparer NuGet package will solve such kinds of complex object comparison problems. By using the NuGet framework, a developer can perform an object-to-object comparer that allows us to compare objects recursively, member by member. An objects comparer can be considered a ready-to-use framework or as a starting point for similar solutions.

More

Thursday, April 12, 2018

Linking an External App Setting Config File to web.config

During software development, the Testing and deployment process in the configuration files continuously undergoes changes in terms of application settings, database connection strings, membership, role, and profile provider information. Changing the web.config file each time is tedious and error prone. Fortunately, ASP.NET provides a configuration system by which a developer can keep application configuration flexible at runtime. Also, the config file is dynamic; a developer can change the value in the config file without compiling and deploying the .NET app.

More

Monday, April 09, 2018

Handling Transactions in .NET Using TransactionScope

The responsibility of the TransactionScope class is to manage local as well as distributed transactions of our .NET Framework code block. The System.Transactions.TransactionScope namespace provides an implicit programming model by which transactions are automatically managed. It provides a simple mechanism for developers to specify a code block to be added in a transaction. TransactionScope is simple, straightforward, reliable, and easy to use. TransactionScope reduces the complexity of the code that needs to use transactions. Without using TransactionScope, a developer has to manage the transaction himself by writing additional code.

Create SQL Server Database Unit Tests Using Visual Studio

Writing database unit test cases are complimentary to the software development life cycle created by software developers. A developer can write unit tests cases to evaluate the success or failure of database design changes and check the results of stored procedures and functions. Unit test cases can ensure any changes applied on the database are as expected and do not introduce new errors. Unit tests, in addition, serve as documentation for users of the methods under test. Developers quickly can review unit tests to determine exactly how a particular database object should be consumed. By developing database unit tests, developers can create a collection of tests and run them during development to make sure all features work as expected.

Mocking API Responses in Azure API Management Portal

A mock API imitates a real API call by providing a realistic JSON or XML response to the requester. Mock APIs can be designed on a developer...