1

i am extending the UserAuth to add more fields into it.

i created a new 'User' table and everything is fine. But the client prefers to stick with the existing 'UserAuth' table and utilize the 'Adding additional metadata to the Meta dictionary fields'.

I have successfully added Meta to responses via a response filter in AppHost.cs but i don't know where/how to add Meta to UserAuth.

Please enlighten me. A small code sample would be much appreciated. Thanks a lot.

Isley
  • 197
  • 15

1 Answers1

0

The UserAuth DTO's has a Meta String Dictionary you can use to store additional metadata about the user.

This previous answer on extending ServiceStack UserAuth provides an example of using the rich UserAuth Metadata extension methods to populate the string dictionary with POCO's, e.g:

userAuth.Set(new Address { ... });
var address = userAuth.Get<Address>();
Community
  • 1
  • 1
mythz
  • 141,670
  • 29
  • 246
  • 390
  • I saw that snippet before. Can i ask how/where do i get this userAuth instance? and do i put it into the confige method in AppHost.cs. Thanks. – Isley Nov 04 '15 at 04:51
  • @Isley You can get it manually from `IAuthRepository` as a normal dependency at anytime as [shown in the custom service example on the previous answer](http://stackoverflow.com/a/33511055/85785). Note you can also cast it to an [IUserAuthRepository](https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack/Auth/IAuthRepository.cs#L19) which most Auth Repos support to get access to a richer API. – mythz Nov 04 '15 at 05:07