Skip to content

Interface ITodoRepository

Namespace: MyApp.Domain
Assembly: MyApp.Domain.dll

Persistence contract for todo items.

public interface ITodoRepository

Remarks

The contract lives in the domain layer so that application services can depend on it without referencing any concrete infrastructure.

Methods

Add(TodoItem)

Adds a new todo item to the store.

void Add(TodoItem item)

Parameters

item TodoItem

The item to add.

Find(Guid)

Returns the todo item with the given identifier, if present.

TodoItem? Find(Guid id)

Parameters

id Guid

The identifier to look up.

Returns

TodoItem?

The matching item, or null when no item exists.

GetAll()

Returns all todo items currently in the store.

IReadOnlyList<TodoItem> GetAll()

Returns

IReadOnlyList<TodoItem>

An ordered, read-only view of every stored item.

Remove(Guid)

Removes the todo item with the given identifier from the store.

bool Remove(Guid id)

Parameters

id Guid

The identifier of the item to remove.

Returns

bool

true when an item was removed; otherwise false.

Update(TodoItem)

Replaces a stored todo item with an updated copy.

void Update(TodoItem item)

Parameters

item TodoItem

The item to update; identified by .