Skip to content

Commit

Permalink
Update README OfX-EFCore, Move OfXConfigFor guide to OfX because it i…
Browse files Browse the repository at this point in the history
…s not depend on EfCore!
  • Loading branch information
quyvu01 committed Jan 7, 2025
1 parent 6706c69 commit ee2a74c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,20 @@ public sealed class SomeDataResponse
}
```

### 3. Write a Handler in Your Service to Fetch the Data when you are using OfX only. If you use OfX-gRPC or other transport data layer(next version extension packages), there are no need to create Handlers anymore!
### 3. Mark the model you want to use with OfXAttribute
Example:

```csharp
[OfXConfigFor<UserOfAttribute>(nameof(Id), nameof(Name))]
public class User
{
public string Id { get; set; }
public string Name { get; set; }
public string Email { get; set; }
}
```

### 4. Write a Handler in Your Service to Fetch the Data when you are using OfX only. If you use OfX-gRPC, OfX-Nats... or other transport data layer(next version extension packages), there are no need to create Handlers anymore, they should be dynamic proxy handlers!
Implement a handler to process data requests. For example:
```csharp
public class UserRequestHandler(): IMappableRequestHandler<UserOfAttribute>
Expand Down
14 changes: 1 addition & 13 deletions src/OfX.EntityFrameworkCore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,8 @@ builder.Services.AddOfXEntityFrameworkCore(cfg =>
});
```

After installing the package OfX-EFCore, you can use the method `AddDbContexts()`, which takes `DbContext(s)` to executing.
Here, you can use the method `AddDbContexts()`, which takes `DbContext(s)` to executing.

### 2. Mark the model you want to use with OfXAttribute
Example:

```csharp
[OfXConfigFor<UserOfAttribute>(nameof(Id), nameof(Name))]
public class User
{
public string Id { get; set; }
public string Name { get; set; }
public string Email { get; set; }
}
```
That all! Let go to the moon!

Note: In this release, Id is exclusively supported as a string. But hold tight—I'm gearing up to blow your mind with the next update! Stay tuned!
Expand Down

0 comments on commit ee2a74c

Please sign in to comment.