Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim-Maes committed Oct 16, 2023
1 parent 87f8b06 commit 82aefb2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ public interface IMyTaskRunner

**Define a generic interface:**

Decorate the generic interface with the [RegisterGenericInterface] attribute.

```csharp
[RegisterGenericInterface]
public interface IRepository<T> where T : BaseEntity
Expand All @@ -107,8 +109,7 @@ public interface IRepository<T> where T : BaseEntity
}
```

**Create implementation:**
Create a class that implements this interface. In the example, we use `[AddTransient]` to indicate that we want transient lifetime for instances of this generic type. Note the use of typeof(IRepository<>) as the argument to the attribute, which means this implementation corresponds to any type parameter that satisfies the constraints.
**Create the implementation:**
```csharp
[AddTransient(typeof(IRepository<>))]
public class Repository<T> : IRepository<T> where T : BaseEntity
Expand Down

0 comments on commit 82aefb2

Please sign in to comment.