Effectively, I am hoping to build an online shop which will use either a SQL or Mongo database inasp.net. Being new to this I have tried following along some of the training packages
in microsoft docs for both webforms and core. when it comes to adding scaffold and (RAZOR pages using entity framework (CRUD)) in either I get the following error :
<<There was an error running the selected code generator. Found invalid data while decoding.>>
most of the tutorials are written for .net framework 2.1 and I am using 3.1 (latest build) is that going to cause the issue? Otherwise, where
is this invalid data as non has been entered anywhere.
The class below is in the models folder
using System;
using System.ComponentModel.DataAnnotations;
namespace RazorPagesMovie.Models
{
public class Movie
{
public int ID { get; set; }
public string Title { get; set; }
[DataType(DataType.Date)]
public DateTime ReleaseDate { get; set; }
public string Genre { get; set; }
public decimal Price { get; set; }
}
}
and then under pages I have an empty Movies folder in which I am trying to build the scaffold for the db. Any help would be appreciated
Data types in the model class look to be fine. Are you selecting a proper model class while scaffolding? Following tutorial series gives step by step approach in doing the same. Specially check the second part of the tutorial.
Hi, thanks for replying. I followed the link to the tutorial you included and followed it to the same point and still get the same error. I even re-installed VS2019 (Community) and tried again but still the same. Am I missing something here?
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
namespace pcore31.Models
{
[Table("pets")]
public class Pet
{
[Key]
public int PetID { get; set; }
[Required(ErrorMessage = "Enter Name")]
public string PetName { get; set; }
public string Dogpic { get; set; }
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}", ApplyFormatInEditMode = true)]
public DateTime? Odate { get; set; }
public bool Ocheck { get; set; }
}
}
None
0 Points
2 Posts
Unable to add scoffolding (RAZOR pages using entity framework (CRUD) in ASP net
Jul 02, 2020 04:08 PM|m0cvo|LINK
Effectively, I am hoping to build an online shop which will use either a SQL or Mongo database in asp.net. Being new to this I have tried following along some of the training packages in microsoft docs for both webforms and core. when it comes to adding scaffold and (RAZOR pages using entity framework (CRUD)) in either I get the following error :
<<There was an error running the selected code generator. Found invalid data while decoding.>>
The class below is in the models folder
and then under pages I have an empty Movies folder in which I am trying to build the scaffold for the db. Any help would be appreciated
All-Star
20953 Points
4984 Posts
Re: Unable to add scoffolding (RAZOR pages using entity framework (CRUD) in ASP net
Jul 02, 2020 04:55 PM|asteranup|LINK
Hi,
Data types in the model class look to be fine. Are you selecting a proper model class while scaffolding? Following tutorial series gives step by step approach in doing the same. Specially check the second part of the tutorial.
https://docs.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/razor-pages-start?view=aspnetcore-3.1&tabs=visual-studio
Anup Das Gupta
Visit My Blog
You can also connect with me in LinkedIn
None
0 Points
2 Posts
Re: Unable to add scoffolding (RAZOR pages using entity framework (CRUD) in ASP net
Jul 03, 2020 11:15 AM|m0cvo|LINK
Hi, thanks for replying. I followed the link to the tutorial you included and followed it to the same point and still get the same error. I even re-installed VS2019 (Community) and tried again but still the same. Am I missing something here?
Member
25 Points
61 Posts
Re: Unable to add scoffolding (RAZOR pages using entity framework (CRUD) in ASP net
Jul 04, 2020 06:15 AM|jimap_1|LINK
Here is one of my models, and works fine in 3.1: