Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. public static class DataStoreInfo
  2. {
  3. public static (string DataDomain, string StoreName) For<TDataModel>() => DataStoreAttributeInfo<TDataModel>.Data;
  4.  
  5. private static class DataStoreAttributeInfo<TDataModel>
  6. {
  7. public static readonly (string DataDomain, string StoreName) Data = typeof(TDataModel)
  8. .GetCustomAttributes(typeof(DataStoreAttribute), true)
  9. .Cast<DataStoreAttribute>()
  10. .Select(s => (s.DataDomain, s.StoreName))
  11. .FirstOrDefault();
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement