> For the complete documentation index, see [llms.txt](https://docs.angel-dart.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.angel-dart.dev/1.x/services/typedservice.md).

# TypedService

* [`TypedService`](/1.x/services/typedservice.md#typedservice)
* [Next Up...](/1.x/services/typedservice.md#next-up)

## TypedService

The vast majority of database adapters for Angel never touch any Dart objects other than Maps. This is good because you are not forced to run reflective code on every query, so you won't wind up creating any inescapable bottlenecks.

However, oftentimes, you will want to serialize and deserialize data in the form of a model class. A `TypedService<T>` performs this for you, and can wrap any other service. Just ensure that your `T` type extends `Model`, found in `package:angel_framework/common.dart`. Combined with the general service pattern, this serves as a sort of mini-ORM that is also database agnostic.

```dart
// foo.dart
class Foo extends Model {
  String bar;

  Foo({this.bar});
}

// foo_service.dart
app.use('/foo', new TypedService<Foo>(new RethinkService(conn, r.table('foo')));

// blah_blah_blah.dart
Foo foo = await app.service('foo').create({'bar': 'baz'});
Foo otherFoo = await app.service('foo').create(new Foo(bar: 'quux'));
```

As a bonus, `Model` classes can be used on the client and server sides of your application. Hurrah!

## Next Up...

See how the `MapService` class lets you manage data [in-memory](https://github.com/angel-dart/angel/wiki/In-Memory).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.angel-dart.dev/1.x/services/typedservice.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
