0

Why is breeze.js not showing entity type names with some of my entities but they are in the metadata instead it gives the entity the following name 'proto._setCtor.proto'. When ever I do an api call that returns an iqueryable of a specific entity, the client shows the results as of type 'proto._setCtor.proto'. Below is an example of my mapping.

public class printer
{
   public Guid PrinterId { get; set; }
   public string SerialNumber { get; set; }

    public virtual ICollection<StaffModel> StaffModels { get; set; }
}

public class Staff
{
   public Guid StaffId { get; set; }
   public string Name { get; set; }

   public int PrinterId { get; set; }
   public virtual Printer Printer { get; set; }
}

public class StaffMap
{
  //all is in a constructor
  ToTable("tblStaff");
  HasKey(x =>x.StaffId);

  Property(x =>x.StaffId);
  Property(x =>x.PrinterId);

  HasOptional(x =>x.printer).WithMany(x=>x.StaffModels).HasForeignKey(x =>x.StaffId);

}

When ever I make a call to the web api(Printers) which returns an IQueryable using breeze the returned entiry type is 'proto._setCtor.proto. If ever I remove the mapping the returned entity type is off type object which is what I want. I am planning to extend the Printer entity on the model but i can not do that if breeze returns 'proto._setCtor.proto' as an entity type.

1 Answer 1

0

Thanks for the #C class definitions but I'm not clear what you're trying to do.

Yes the type of the returned object is a funny internal Breeze type named "proto._ctor.proto". That's the constructor that Breeze uses when it creates instances of entities which do not have custom constructors. If you created a custom constructor for it, you would see that name instead.

But this shouldn't hinder you. Try putting a breakpoint in the success callback for a simple query. The following returns a clean EntityType for me:

data.results[0].entityType;

This returns the same results in both KO and Angular models.

This is the EntityType that you would extend by creating a custom constructor in the manner described in "Extending Entities". You don't extend the instance itself nor the Breeze default constructor.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.