title: Akka.net / Generics and Database & Entity Framework
body: <p>Hi there I am fairly new to akka.net! so appologize any strange questions :-)</p>
  
  <p>I am working on actors which are accessing a database. One is reading and one is writing. Both are goverend by a router creating them as needed based on workload.</p>
  
  <p>In order to avoid to create for every type in the database I want to use Generics in combination with Expressions. The message along the the following lines:</p>
  
  <pre><code>public class Msg&lt;T&gt; 
  {
     public Expression&lt;Func&lt;IEnumerable&lt;T&gt;, T, IEnumerable&lt;T&gt;&gt;&gt; Expr { get; }
  
          public MsgExprObjBool (Expression&lt;Func&lt;IEnumerable&lt;T&gt;, T, IEnumerable&lt;T&gt;&gt;&gt; expr)
          {
              Expr = expr;
          }
  }
  </code></pre>
  
  <p>within the actor I'd like to use the Expression defined and retrieve the entities as requested for further processing or send them back at least - like so:</p>
  
  <pre><code>public class MyActor : ReceiveActor
  {
      public MyActor ()
      {
        Receive&lt;MsgExprBool&lt;Foo&gt;&gt; (s =&gt; Console.WriteLine ($"Result&lt;Material&gt; == {s.Expr.Compile () (_foos)}"));
  
        Receive&lt;MsgExprBool&lt;Boo&gt;&gt; (s =&gt; Console.WriteLine ($"Result&lt;Boo&gt; == {s.Expr.Compile () (_boos)}"));
  
        Receive&lt;MsgExprObjBool&lt;Qoo&gt;&gt; (s =&gt;
          {
              foreach (var r in s.Expr.Compile () (_Qoos, qoo))
                  Console.WriteLine ($"Result&lt;Qoo&gt; == {q.Id}, {q.Name}");
          });
      }
  }
  </code></pre>
  
  <p>My question is now, has anybody been using this approach to access a database and if so, what are the experiances with that?</p>
  
  <p>REM:
  Since the actor system is <strong>NOT</strong> communicating with any foreign requestors all share a set of common object definitions - like the database objects.</p>