locked
C1502 After updating entity model on old project RRS feed

  • Question

  • Hello Everyone, I'm trying to update an old project I did on Visual Studio 2010 using WebForms, the project has an "edmx/RDCL" report,  when I open the edmx file it says :

    The Entity Data Model Designer is unable to to display the file you requested. The file references an XML namespace that is inconsistent with the Entity Framework Schema version of the model.

    You can modify the XML namespace reference to match the Entity Framework schema version

    or edit the model in the XML Editor

    If I click to modify the file it goes through the process and create an entity model with the three tables I expected, but trying to run the report gives me a C1502 error for every single field in every table:

    Error CS1502 The best overloaded method match for

    'System.Data.Objects.DataClasses.StructuralObject.SetValidValue(byte[], bool)' has some invalid arguments

    This is the first piece of code for the first field when this error is reported:

     [EdmEntityTypeAttribute(NamespaceName="AbsoluteVideoModel", Name="Judge")]
        [Serializable()]
        [DataContractAttribute(IsReference=true)]
        public partial class Judge : EntityObject
        {
            #region Factory Method
        
            /// <summary>
            /// Create a new Judge object.
            /// </summary>
            /// <param name="pK_Judges">Initial value of the PK_Judges property.</param>
            public static Judge CreateJudge(global::System.Int32 pK_Judges)
            {
                Judge judge = new Judge();
                judge.PK_Judges = pK_Judges;
                return judge;
            }
    
            #endregion
    
            #region Simple Properties
        
            /// <summary>
            /// No Metadata Documentation available.
            /// </summary>
            [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
            [DataMemberAttribute()]
            public global::System.Int32 PK_Judges
            {
                get
                {
                    return _PK_Judges;
                }
                set
                {
                    if (_PK_Judges != value)
                    {
                        OnPK_JudgesChanging(value);
                        ReportPropertyChanging("PK_Judges");
                        _PK_Judges = StructuralObject.SetValidValue(value, "PK_Judges");
                        ReportPropertyChanged("PK_Judges");
                        OnPK_JudgesChanged();
                    }
                }
            }
            private global::System.Int32 _PK_Judges;
            partial void OnPK_JudgesChanging(global::System.Int32 value);
            partial void OnPK_JudgesChanged();

    It seems that even when the field "pk_judges" is clearly define as int32 StructuralObject.SetValidValue doesn't recognize that and try to use "byte[]", StructuralObject.SetValidValue has 32 overloads including one that accepts "Int"

    I understand that probably is best to leave the original code as is, or just redo everything from scratch, if that is the case please let me know,

    Thank you all!



    Luis

    Friday, November 27, 2020 10:43 PM

Answers

  • Hi LazyCod3r,
    For your question, I suggest you ask the question on the Microsoft Q&A forum and you can get more professional answer.
    Thank you for your understanding.
    Best Regards,
    Daniel Zhang


    "Visual c#" forum will be migrating to a new home on Microsoft Q&A ! We invite you to post new questions in the "Developing Universal Windows apps" forum’s new home on Microsoft Q&A ! For more information, please refer to the sticky post.



    Monday, November 30, 2020 6:03 AM

All replies

  • Hi LazyCod3r,
    For your question, I suggest you ask the question on the Microsoft Q&A forum and you can get more professional answer.
    Thank you for your understanding.
    Best Regards,
    Daniel Zhang


    "Visual c#" forum will be migrating to a new home on Microsoft Q&A ! We invite you to post new questions in the "Developing Universal Windows apps" forum’s new home on Microsoft Q&A ! For more information, please refer to the sticky post.



    Monday, November 30, 2020 6:03 AM
  • Thanks Daniel! will do.

    Luis

    Monday, November 30, 2020 1:27 PM