title: C# Odata WebApi List of Elements in Post
body: <p>i could realy need some help.</p>
  
  <p>Im coding a small WebApi Program.</p>
  
  <p>While Unit testing i noticed i cant send a list of Elements to my post Method.</p>
  
  <p>First take a look at my Unit Test:</p>
  
  <pre><code> [TestMethod]
      public async Task PostWithExpandoObjectSerilasationToDataType()
      {
          //Define an imaginary Car Object
          List&lt;dynamic&gt; listExpando = new List&lt;dynamic&gt;();
  
          dynamic obj1 = new ExpandoObject();
          obj1.Attribute = "PS";
          obj1.DataType = "Integer";
          obj1.EntityId = "3";
          obj1.DefaultValue = "";
  
          dynamic obj2 = new ExpandoObject();
          obj2.Attribute = "Color";
          obj2.DataType = "Text Only";
          obj2.EntityId = "3";
          obj2.DefaultValue = "";
  
          dynamic obj3 = new ExpandoObject();
          obj3.Attribute = "Km";
          obj3.DataType = "Number";
          obj3.EntityId = "3";
          obj3.DefaultValue = "1.3";
  
          listExpando.Add(obj1);
          listExpando.Add(obj2);
          listExpando.Add(obj3);
  
          JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
          javaScriptSerializer.RegisterConverters(new JavaScriptConverter[] { new ExpandoJsonconverter() });
  
          string jsonOfTest = javaScriptSerializer.Serialize(listExpando);
  
          // arrange
          UnityContainer container = UnityConfig.RegisterComponents();
          var start = new Startup(container);
  
          using (TestServer server = TestServer.Create(builder =&gt; start.Configuration(builder)))
          {
              using (var client = new HttpClient(server.Handler))
              {
  
                  HttpContent content = new StringContent(jsonOfTest, Encoding.UTF8, "application/json");
  
                  var request = new HttpRequestMessage
                  {
                      RequestUri = new Uri("http://testserver/odata/Attributes"),
                      Method = HttpMethod.Post,
                      Content = content
                  };
  
                  string jsonContent = content.ReadAsStringAsync().Result;
                 request.Headers.Add("Prefer", "return=representation");
  
                  // act
                  HttpResponseMessage response = await client.SendAsync(request);
                  Attributes result = response.Content.ReadAsAsync&lt;Attributes&gt;().Result;
  
                  // assert
                  Assert.IsNotNull(response);
                  Assert.AreEqual(HttpStatusCode.Created, response.StatusCode);
                  Assert.IsNotNull(result, "No result content found");
                  Assert.IsNotNull(result.Attribute);
              }
          }
      }
  </code></pre>
  
  <p>Next here is my Post Method:</p>
  
  <pre><code> public IHttpActionResult Post([ModelBinder]IEnumerable&lt;Attributes&gt; att)
      {....}
  </code></pre>
  
  <p>When it comes to the Post Method
  att is alway null</p>
  
  <p>When trying the Service with Rest i get this message:</p>
  
  <p>"message": "Collection(EAVService.Entities.Attributes) is not an entity type. Only entity types are supported."</p>
  
  <p>Googled and tried different things but i didnt found a working solution</p>
  
  <p>Any one there who can help me to solve my problem? :)</p>
  
  <p>Best Regards
  Andre</p>