Cats are known to have cats, dogs and dogs, and cats cannot produce dogs. The same entity is a strongly-typed relationship that often causes errors due to typing errors. Nothing but 1.1 points of the exclusion of the wrong, but Viewmodle, you will go to see it?
There is an error called "automapper.automappermappingexception" type exception occurs in AutoMapper.dll, but not in user code ", can also be called" Missingtype map Configuration or unsupported mapping ", anyway, is type mismatch.
This is a method in Staticcontentbll, the type is staticcontent, but when the error is displayed, the type is the category type. Nani?
<summary>///query static content (public)///</summary>//<param name= "CategoryID" > Root By category query static content (public) </param>////<returns> return static content viewmodle</returns> publicly LIST<STATICCONTENTV Iewmodel> querystaticcontent (Staticcontentviewmodel encategory, int pageSize, int pageIndex, out int. total) { Call the underlying, query staticcontent collection generic list<staticcontent> liststaticcontent = this. Currentdal.loadpageitems (PageSize, pageIndex, out total,p = P.categoryid = Encategory.categoryid, p = p. TimeStamp, False). ToList (); Create conversion rules, convert entities Mapper.createmap<staticcontent, staticcontentviewmodel> (); var liststaticcontentvm = Mapper.map<list<staticcontent>, list<staticcontentviewmodel>> ( Liststaticcontent); Return query result return LISTSTATICCONTENTVM; }The last-hammered error is in Viewmodle. Viewmodle things are generally derived from the model directly, including the various attributes and foreign keys, as follows:
<summary>//static content table, storage organization settings, Unit introduction, etc.///</summary> [DataContract] public partial class Static Contentviewmodel {//<summary>///static Content ID//</summary> [DataMember] Public System.Guid Staticcontentid {get; set;} <summary>///static content topics///</summary> [DataMember] public string Staticcontentti tle {get; set;} <summary>//static content content///</summary> [DataMember] public string Staticcontentco ntent {get; set;} <summary>//Pictures///</summary> [DataMember] public string Images {get; set; }///<summary>//time stamp///</summary> [DataMember] public System.DateTime TimeStamp {get; set;} <summary>///Add Person ID///</summary> [DataMember] public system.guid Userguid { Get SeT }///<summary>///Category ID///</summary> [DataMember] public System.Guid Cat Egoryid {get; set;} <summary>///Navigation Properties-category///</summary> public virtual Categoryviewmodel category {get; Set }///<summary>//Navigation Properties-User information///</summary> public virtual Userinfoviewmodel user Info {get; set;} }Viewmodle is the business domain data, should not be placed foreign key, put the foreign key is equal to introduce another type, so the final type is mixed. Well, that's what I understand.
MVC development errors, type exceptions in C #