Skip to content

Commit

Permalink
Update README.md (#2)
Browse files Browse the repository at this point in the history
Fix typos
  • Loading branch information
nattster committed Nov 2, 2020
1 parent e3ee6fa commit d6c8868
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Expand Up @@ -9,7 +9,7 @@ C# IoC extension library, used at Agoda for Registration of classes into IoC con

In some of our larger projects at Agoda, the Dependency injection registration was done in a single or set of "configuration" classes. These large configuration type files are troublesome due to frequency of merge conflicts. Also to look at a normal class and know if it will be run as a singleton or transient you need to dig into these configuration classes.

By declaring the IoC configuration at the top of each class in an attribute it makes it immediately clear to the developer what the class's lifecycle is when running, and avoids large complex configuration classes that are prone to merge conflcits.
By declaring the IoC configuration at the top of each class in an attribute it makes it immediately clear to the developer what the class's lifecycle is when running, and avoids large complex configuration classes that are prone to merge conflicts.

## Adding to your project

Expand All @@ -26,11 +26,11 @@ Install-Package Agoda.IoC.NetCore
}
```

You need to pass in an array of all the assemblies you want to scan in your project for registration. As well as a boolean indicating if you applcation is running in Mocked mode or not.
You need to pass in an array of all the assemblies you want to scan in your project for registration. As well as a boolean indicating if your application is running in Mocked mode or not.

## Usage in your project

The basic usage of this project allow you to use 3 core attributes on your classes (RegisterTransient, RegisterPerRequest, RegisterSingleton) like the following code:
The basic usage of this project allows you to use 3 core attributes on your classes (RegisterTransient, RegisterPerRequest, RegisterSingleton) like the following code:

```csharp

Expand All @@ -45,7 +45,7 @@ Replaces something like this in your startup.
services.AddSingleton<IService , Service>();
```

The library will assembly scan your app at start-up and register services in IoC container based on the attribute and it's parameters.
The library will assembly scan your app at start-up and register services in IoC container based on the attribute and its parameters.

Factory options are available for registration with the attributes, as seen below, the factory needs a "Build" method

Expand Down Expand Up @@ -84,7 +84,7 @@ And may more options...

## Mocked Mode?

Mocked mode is used for mocking external dependencies, this should be used on repository type classes that access a database for example. so you can run system tests on your application without the need for external dependencies.
Mocked mode is used for mocking external dependencies, this should be used on repository type classes that access a database for example. So you can run system tests on your application without the need for external dependencies.

Below example demonstrates using attributes to indicate a mock option for a registration.

Expand All @@ -100,11 +100,11 @@ Below example demonstrates using attributes to indicate a mock option for a regi

## A Unity 3.5 Project?

Some of the old legacy systems at Agoda run an old version of unity, and this library was originally developed against that. These days every thing is moving towards net core, but we still decided to publish the original unity library as well.
Some of the old legacy systems at Agoda run an old version of unity, and this library was originally developed against that. These days everything is moving towards net core, but we still decided to publish the original unity library as well.

## This is using reflection, isn't that slow?

Reflection is not slow, it's pretty fast in C# actually. Where you will hit problems with relfection and speed is if you are doing thousands or millions of opperations, like in a http request on a busy website, using it at startup like this you are doing very few opperations and only when the applicaiton starts.
Reflection is not slow, it's pretty fast in C# actually. Where you will hit problems with reflection and speed is if you are doing thousands or millions of operations, like in a http request on a busy website, using it at startup like this you are doing very few operations and only when the application starts.

## Dedication
A large amount of the code in this repository was written by Michael Alastair Chamberlain who is no longer with us, so it is with this community contribution we remember him.

0 comments on commit d6c8868

Please sign in to comment.