Skip to content

Commit

Permalink
Add sample how to use CRUD generation
Browse files Browse the repository at this point in the history
  • Loading branch information
kant2002 committed Nov 30, 2024
1 parent 000b125 commit 64e5342
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,41 @@ public partial class DataContext
}
```

You can have simplified repository generator.
Detection happens by name, and I plan to automatically support more naming conventions.

```csharp
public class Product
{
public int Id { get; set; }

public string? Code { get; set; }
public string? ProductTitle { get; set; }
public string? Description { get; set; }
}

public partial class DataContext
{
private DbConnection connection;

public DataContext(DbConnection connection) => this.connection = connection;

public partial IList<Product> FetchAll();

public partial Product? FetchById(int id);

public partial int Count();

public partial void DeleteAll();

public partial void DeleteById(int id);

public partial void Insert(int id, string code, string productTitle, string description);

public partial void Update(int id, string code, string productTitle, string description);
}
```

# Temporary limitations or plans
Current version of library has several limitations which not because it cannot be implemented reasonably,
but because there was lack of time to think through all options. So I list all current limitations, so any user would be aware about them.
Expand Down

0 comments on commit 64e5342

Please sign in to comment.