c# - How do I have to pass a MemberInitExpression object -


When I run this code, I get an exception to the update method

  Public Zero UpdateTeststep (teststep phase) {_context.Teststeps.Where (t = & gt; t.TeststepId == step.txtstepid). Update (t = & gt; phase); _context.SaveChanges (); } {"Update expression should be of member type. InitExpression. \ R \ nParametername: updateExpression"}   

What's wrong with my updates?

The source code of the update method:

line 454:

  var member as InitExpression = updateExpression.Body MemberInitExpression; If (memberInitExpression == faucet) throwing new logic exception ("Update expression member type should be InitExpression.", "UpdateExpression");   

Why do I have to tap the value? Do I pass my test incorrectly?

Let's say that there is a unit person a DBCCText derived class TestDbContext with related set person

  public class person {[Key] Public Ent ID {Received; Set; } Public string name {get; Set; }}   

Then a batch update can be written using EntityFrameworkExtended:

  [TestMethod] Public Zero UpdatePersonName () {(var context = new TestDbContext ()) {// Insert 'Initial' person's name should be referenced by changing. PERSons.Add (new person {name = "andyp"}); Context.SaveChanges (); Assure. First (1, reference number.); Assurance.Are aqual ("Endeavor", context.selections (P => P. names). Single ()); // Update the reference of the names of the persons Pressen Where (P => PIID == 1). Update (p = & gt; new person {name = "pascal"}); // say that the update has been successful. Assert.AreEqual (1, context.Persons.Count ()); Assurance.Are aqual ("Pascal", Reference. Selection (P => P. Name). Single ()); }}   

Note that I am updating only one unit ( Id == 1 ), but where condition is a Selecting more than the unit is definitely valid. Update expression allows more than one asset to be converted at a time.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -