Cant retrieve information from table in ASP.NET Entity Framework - c#

Can't find why the object I'm supposed to retrieve from database is always empty, despite the fact that the table has 3 elements. In the view, Model.Count is always == 0. New to dotnet, stuck for hours.
What I did :
connection string in app.config
connection string in web.config
<connectionStrings>
<add name="masterEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string="data source=DESKTOP-K74JGDL\SQLEXPRESS;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
<add name="DBModel" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1 .msl;provider=System.Data.SqlClient;provider connection string="data source=DESKTOP-K74JGDL\SQLEXPRESS;initial catalog=core2DB;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
restart SQL Server
Controller seems to know about my tables since it autocomplete tables and keys.
Posts.cs
namespace WebApplication1.Data
{
public partial class Posts
{
public int Id { get; set; }
public Nullable<int> Post_owner { get; set; }
public string Post_content { get; set; }
public Nullable<int> Post_like_count { get; set; }
public virtual Users Users { get; set; }
}
}
Model1.Context.Cs:
namespace WebApplication1.Data
{
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
public partial class DBModel : DbContext
{
public DBModel() : base("DBModel")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
/* Database.SetInitializer<DBModel>(null);
base.OnModelCreating(modelBuilder);*/
}
public virtual DbSet<Posts> Posts { get; set; }
public virtual DbSet<Users> Users { get; set; }
}
}
In PostController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebApplication1.Data;
using WebApplication1.Models;
using System.Diagnostics;
namespace WebApplication1.Controllers
{
public class PostController : Controller
{
// GET: Post
public ActionResult Index()
{
var context = new DBModel();
List<Posts> postsList = new List<Posts>();
if (!context.Posts.Any())
{
/* postsList = 3;*/
}
postsList = context.Posts.ToList();
/* using (var context = new DBModel())
{
postsList = context.Posts.ToList();
}*/
return View(postsList);
}
}
}
and the view is (Index.cshtml) :
#model List<WebApplication1.Data.Posts>
#{
ViewBag.Title = "Index";
}
<h2>Hello Peyo</h2>
<div>#Model</div>
#foreach (var post in Model)
{
<div><span>Nom: </span><span>#post.Post_content</span></div>
}
<span>Hello again</span>

Related

The ALTER TABLE statement conflicted with the FOREIGN KEY constraint on my asp.net app

I have problem with my first web application , when I start the application Im getting this error:
1st img
2nd img
The application is about car rental.
1.I will show my data structure: for CarCategory and SmallCars
--CARCATEGORY
namespace CarRentalSystem.Data.Models
{
using System.Collections.Generic;
using CarRentalSystem.Data.Common.Models;
public class CarCategory : BaseDeletableModel<int>
{
public CarCategory()
{
this.SmallCars = new HashSet<SmallCarInfo>();
}
public string Name { get; set; }
public string Title { get; set; }
public string CarDescription { get; set; }
public string CarImageUrl { get; set; }
public virtual ICollection<SmallCarInfo> SmallCars { get; set; }
}
}
--SMALLCARS
namespace CarRentalSystem.Data.Models
{
using System;
using System.Collections.Generic;
using System.Text;
using CarRentalSystem.Data.Common.Models;
public class SmallCarInfo : BaseModel<int>
{
public string CarModel { get; set; }
public string CarImage { get; set; }
public int CarPricePerDay { get; set; }
public int CategoryId { get; set; }
public virtual CarCategory Category { get; set; }
}
}
Now I make a migration and im going to make two SEEDERS with data:
--CAR CATEGORIES SEEDER
namespace CarRentalSystem.Data.Seeding
{
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using CarRentalSystem.Data.Models;
using Microsoft.EntityFrameworkCore.Internal;
public class CategoriesSeeder : ISeeder
{
public async Task SeedAsync(ApplicationDbContext dbContext, IServiceProvider serviceProvider)
{
if (dbContext.CarCategories.Any())
{
return;
}
var carCategories = new List<(string Name, string ImageUrl, string CarDescription)>
{
("Small car", "https://cdn4.iconfinder.com/data/icons/car-silhouettes/1000/city-car-128.png",
"This is a compact car with 2/3 doors. Perfect for couples with small luggage."),
("Medium car", "https://cdn4.iconfinder.com/data/icons/car-silhouettes/1000/sedan-128.png",
"This is medium car with 4/5 doors. Perfect for small families with average luggage."),
("Minivan", "https://cdn4.iconfinder.com/data/icons/car-silhouettes/1000/minivan-128.png",
"This is a large car with 4/5 doors + extra seats. Perfect for large families with average luggage."),
("Minibus", "https://cdn4.iconfinder.com/data/icons/car-silhouettes/1000/van-128.png",
"This is a large car with 8+1 seats with big trunk. Perfect for large families or companies with a lot of luggage"),
};
foreach (var category in carCategories)
{
await dbContext.CarCategories.AddAsync(new CarCategory
{
Name = category.Name,
Title = category.Name,
CarImageUrl = category.ImageUrl,
CarDescription = category.CarDescription,
});
}
dbContext.SaveChanges();
}
}
}
--SMALL CARS SEEDER
namespace CarRentalSystem.Data.Seeding
{
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using CarRentalSystem.Data.Models;
using Microsoft.EntityFrameworkCore.Internal;
public class SmallCarsSeeder : ISeeder
{
public async Task SeedAsync(ApplicationDbContext dbContext, IServiceProvider serviceProvider)
{
if (dbContext.SmallCar.Any())
{
return;
}
var carDetails = new List<(string CarModel, string CarImage, int CarPricePerDay)>
{
("Nissan Micra", "https://5.imimg.com/data5/BV/XC/RV/SELLER-85643879/nissan-micra-xl-o-cvt-turquoise-blue-1198-cm3-car-500x500.jpg", 15),
("Ford Fiesta", "https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcT_s9VktREdvkJUF9uU2V4NWIOzxU4Olk8IdTO2DOfjbAnsJQcU&usqp=CAU", 15),
};
foreach (var details in carDetails)
{
await dbContext.SmallCar.AddAsync(new SmallCarInfo
{
CarModel = details.CarModel,
CarImage = details.CarImage,
CarPricePerDay = details.CarPricePerDay,
});
}
dbContext.SaveChanges();
}
}
}
3.Now Im making CONTROLLERS + SERVICES/VIEW-MODELS and VIEWS
--CONTROLLER FOR CHOOSING SMALL CARS
namespace CarRentalSystem.Web.Controllers
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CarRentalSystem.Data.Models;
using CarRentalSystem.Services.Data;
using CarRentalSystem.Web.ViewModels.Categories;
using Microsoft.AspNetCore.Mvc;
public class CategoriesController : Controller
{
private readonly ICategoriesService categoriesService;
public CategoriesController(ICategoriesService categoriesService)
{
this.categoriesService = categoriesService;
}
public IActionResult ChooseCars(string name)
{
var viewModel =
this.categoriesService.GetByName<CarsListViewModel>(name);
return this.View(viewModel);
}
}
}
--"GetByName" SERVICE LOGIC
namespace CarRentalSystem.Services.Data
{
using System;
using System.Collections.Generic;
using System.Text;
public interface ICategoriesService
{
IEnumerable<T> GetAll<T>(int? count = null);
T GetByName<T>(string name);
}
}
namespace CarRentalSystem.Services.Data
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CarRentalSystem.Data.Common.Repositories;
using CarRentalSystem.Data.Models;
using CarRentalSystem.Services.Mapping;
public class CategoriesService : ICategoriesService
{
private readonly IDeletableEntityRepository<CarCategory> categoriesRepository;
public CategoriesService(IDeletableEntityRepository<CarCategory> categoriesRepository)
{
this.categoriesRepository = categoriesRepository;
}
public IEnumerable<T> GetAll<T>(int? count = null)
{
IQueryable<CarCategory> query =
this.categoriesRepository.All();
if (count.HasValue)
{
query = query.Take(count.Value);
}
return query.To<T>().ToList();
}
public T GetByName<T>(string name)
{
var category = this.categoriesRepository.All()
.Where(x => x.Name.Replace(" ", "-") == name.Replace(" ", "-"))
.To<T>().FirstOrDefault();
return category;
}
}
}
-- TWO VIEW-MODELS THAT GET DATA FROM DATA MODELS AND MAPPING
namespace CarRentalSystem.Web.ViewModels.Categories
{
using System;
using System.Collections.Generic;
using System.Text;
using CarRentalSystem.Data.Models;
using CarRentalSystem.Services.Mapping;
public class CarsListViewModel : IMapFrom<CarCategory>
{
public string Name { get; set; }
public string Title { get; set; }
public string CarDescription { get; set; }
public IEnumerable<CarsViewModel> SmallCars { get; set; }
}
}
namespace CarRentalSystem.Web.ViewModels.Categories
{
using System;
using System.Collections.Generic;
using System.Text;
using CarRentalSystem.Data.Models;
using CarRentalSystem.Services.Mapping;
public class CarsViewModel : IMapFrom<SmallCarInfo>
{
public string CarModel { get; set; }
public string CarImage { get; set; }
public int CarPricePerDay { get; set; }
}
}
--THE VIEW WITH RAZOR
#using CarRentalSystem.Common
#model CarRentalSystem.Web.ViewModels.Categories.CarsListViewModel
#{
this.ViewData["Title"] = "Cars";
}
<h1 class="display-3">#Model.Title</h1>
<div class="row">
#foreach (var details in Model.SmallCars)
{
<div class="card" style="width: 18rem;">
<img src="#details.CarImage" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">#details.CarModel</h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item">#details.CarPricePerDay euro.</li>
<li class="list-group-item">Dapibus ac facilisis in</li>
<li class="list-group-item">Vestibulum at eros</li>
</ul>
<div class="card-body">
Card link
Another link
</div>
</div>
}
</div>
And now when I start the app Im getting the error that I showed at the top.
Picture of the CARCATEGORY table
Picture of the SMALLCARS table
How can I fix the problem with FK confliction? Thanks!

Doesn't contain definition for 'Books'

I am currently making a small application with basic CRUD operations and I want to display all Books in my View. But when I call .Booksobject it's written that:
'IndexModel' does not contain a definition for 'Books' and no accessible extension method 'Books' accepting a first argument of type 'IndexModel' could be found (are you missing a using directive or an assembly reference?)
Here is what I did so far:
Book Model
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace CRUD_Razor_2_1.Model
{
public class Book
{
public int Id { get; set; }
[Required]
public string Name { get; set; }
public string ISBN { get; set; }
public string Author { get; set; }
}
}
ApplicationDbContext
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace CRUD_Razor_2_1.Model
{
public class ApplicationDbContext : DbContext
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options)
{
}
public DbSet<Book> Books { get; set; }
}
}
Index.html.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CRUD_Razor_2_1.Model;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace CRUD_Razor_2_1.Pages.BookList
{
public class CreateModel : PageModel
{
private readonly ApplicationDbContext _db;
public CreateModel(ApplicationDbContext db)
{
_db = db;
}
[BindProperty]
public Book Book { get; set; }
public void OnGet()
{
}
public async Task<IActionResult> OnPost()
{
if(!ModelState.IsValid)
{
return Page();
}
_db.Books.Add(Book);
await _db.SaveChangesAsync();
return RedirectToPage("Index");
}
}
}
And here when I want to call Model.Book.Count() is where I get the error:
#page
#model IndexModel;
#{
}
<br />
<h2>Book List</h2>
<br />
<a asp-page="Create" class="btn btn-primary">Create New Book</a>
#if(Model.Books.Count() > 0)
{
}
else
{
}

Connecting to a Microsoft SQL Database from ASP.NET web service

I have been trying to connect to a Microsoft SQL Server through a web service in visual studio 2015. However, I am having difficulty trying to retrieve data from the database.
In my web config file, I have the following code:
<add name="SecondlyReadingsContext" connectionString="Data Source=myserver;Initial Catalog=SecondlyReadingsContext;user=sa;password=adminadmin2" providerName="System.Data.SqlClient" />
I assume(might be wrong) that the code above establishes a connection with the server and the database itself. I referenced the above code from the following link:
Connecting to SQL server from Restful C# service
In my Model class, I have the following code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
namespace HelloWorld.Models.APiModels
{
public class SecondlyReading
{
[Key]
public int Id { get; set; }
[Required]
public int ChannelID { get; set; }
[Required]
public string TimeStamp { get; set; }
[Required]
public float RMSVoltage { get; set; }
[Required]
public float Frequency { get; set; }
[Required]
public float RMSCurrent { get; set; }
[Required]
public float RealPower { get; set; }
[Required]
public float ReactivePower { get; set; }
[Required]
public float ApparentPower { get; set; }
[Required]
public float PowerFactor { get; set; }
[Required]
public string DeviceId { get; set; }
//[ForeignKey("DeviceId")]
//public virtual Device Device { get; set; }
}
}
In my Controller, I have this:
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Description;
using HelloWorld.Models;
using HelloWorld.Models.APiModels;
namespace HelloWorld.Controllers
{
public class SecondlyReadingsController : ApiController
{
private SecondlyReadingsContext db = new SecondlyReadingsContext();
// GET: api/SecondlyReadings
public IQueryable<SecondlyReading> GetSecondlyReadings()
{
return db.SecondlyReadings;
}
// GET: api/SecondlyReadings/5
[ResponseType(typeof(SecondlyReading))]
public IHttpActionResult GetSecondlyReading(int id)
{
SecondlyReading secondlyReading = db.SecondlyReadings.Find(id);
if (secondlyReading == null)
{
return NotFound();
}
return Ok(secondlyReading);
}
// PUT: api/SecondlyReadings/5
[ResponseType(typeof(void))]
public IHttpActionResult PutSecondlyReading(int id, SecondlyReading secondlyReading)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
if (id != secondlyReading.Id)
{
return BadRequest();
}
db.Entry(secondlyReading).State = EntityState.Modified;
try
{
db.SaveChanges();
}
catch (DbUpdateConcurrencyException)
{
if (!SecondlyReadingExists(id))
{
return NotFound();
}
else
{
throw;
}
}
return StatusCode(HttpStatusCode.NoContent);
}
// POST: api/SecondlyReadings
[ResponseType(typeof(SecondlyReading))]
public IHttpActionResult PostSecondlyReading(SecondlyReading secondlyReading)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
db.SecondlyReadings.Add(secondlyReading);
db.SaveChanges();
return CreatedAtRoute("DefaultApi", new { id = secondlyReading.Id }, secondlyReading);
}
// DELETE: api/SecondlyReadings/5
[ResponseType(typeof(SecondlyReading))]
public IHttpActionResult DeleteSecondlyReading(int id)
{
SecondlyReading secondlyReading = db.SecondlyReadings.Find(id);
if (secondlyReading == null)
{
return NotFound();
}
db.SecondlyReadings.Remove(secondlyReading);
db.SaveChanges();
return Ok(secondlyReading);
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
db.Dispose();
}
base.Dispose(disposing);
}
private bool SecondlyReadingExists(int id)
{
return db.SecondlyReadings.Count(e => e.Id == id) > 0;
}
}
}
I have also been told that I am supposed to do some kind of database connection in the following SecondlyReadingContext.cs file, but I am not sure of how to go about it:
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
namespace HelloWorld.Models
{
public class SecondlyReadingsContext : DbContext
{
// You can add custom code to this file. Changes will not be overwritten.
//
// If you want Entity Framework to drop and regenerate your database
// automatically whenever you change your model schema, please use data migrations.
// For more information refer to the documentation:
// http://msdn.microsoft.com/en-us/data/jj591621.aspx
public SecondlyReadingsContext() : base("name=SecondlyReadingsContext")
{
}
public System.Data.Entity.DbSet<HelloWorld.Models.APiModels.SecondlyReading> SecondlyReadings { get; set; }
}
}
When I run my server through IIS manager and add api/SecondlyReadings to the url, I am supposed to get the data back in json format, however, I am not retrieving any data and it returns a blank page(in a notepad, as I run it in Internet Explorer). Would anyone tell me what I have done wrong in my code, or anything that I have missed out. I have been working on this for a while and would really appreciate any help.
For reference, this is the dummy data that I added into the Microsoft SQL server which I am trying to retrieve:
My context file to after adding bindings:
Error after editing web.config file:
Updated result after editing web.config file
Set Initial Catalog to the name of your Database. Right now it's set to SecondlyReadingsContext, which I assume isn't the name of your Database.
Set your tables binding here to get data
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
}
public virtual DbSet<SecondlyReading> SecondlyReadings { get; set; }
Remember to re-name your table name on SQL Server End. to SecondlyReading

Table values are not showing - ASP.net

This might be a dumb question as I'm new to the MVC pattern in asp.net.
I'm trying to access to the value in my database but the values don't get rendered
on the view page.
here's the code I have written.
code for the "Resturant" model:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;
namespace OdetoFood.Models
{
[Table("Resturants")]
public class Resturant
{
public int Id { get; set; }
public string Name { get; set; }
public string City { get; set; }
public string Country { get; set; }
public ICollection<ResturantReviews> Reviews { get; set; }
}
}
here's my DbContext model:
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
namespace OdetoFood.Models
{
public class OdeToFoodDb : DbContext
{
public DbSet<Resturant> Resturants { get; set; }
public DbSet<ResturantReviews> Reviews { get; set; }
}
}
Code for the controller class:
public class HomeController : Controller
{
OdeToFoodDb _db = new OdeToFoodDb();
public ActionResult Index()
{
var model = _db.Resturants.ToList();
return View(model);
}
and here's the view that should be displaying the values:
#model IEnumerable<OdetoFood.Models.Resturant>
#{
ViewBag.Title = "Home Page";
}
#foreach (var item in Model)
{
<h3>#item.Name</h3>
<div>#item.City, #item.Country</div>
<div>#item.Id</div>
}
the connection string in Web.config is setup like this:
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-OdetoFood-20150611025411.mdf;Initial Catalog=aspnet-OdetoFood-20150611025411;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
What am I doing wrong here?
This would be the seed method for that project:
protected override void Seed(OdeToFood.Models.OdeToFoodDb context)
{
context.Restaurants.AddOrUpdate(r => r.Name,
new Restaurant { Name = "Sabatino's", City = "Baltimore", Country = "USA" },
new Restaurant { Name = "Great Lake", City = "Chicago", Country = "USA" },
new Restaurant
{
Name = "Smaka",
City = "Gothenburg",
Country = "Sweden",
Reviews =
new List<RestaurantReview>{
new RestaurantReview{ Rating = 9, Body="Great Food!" }
}
});
}

EF - could not find a model

I have 2 similar DBs. So, both DBs have tables AllowedDates and AllowedTimes (with the same structore). I try to connect to these 2 DBs in my project. I created first model (DB.edmx) for first DB and second model (TEX.edmx) for second DB. Also, I renamed to AllowedDateTex and AllowedTimeTex EntityTypes for TEX.edmx to prevent name conflict of classes. In result, I have error in any case on line:
List<AllowedDateTex> allowedDatesTex = (from i in _dbContextTex.AllowedDateTexes select i).ToList();
Additional information: Could not find the conceptual model type for
'ITW2012Mobile.Models.AllowedDate'.
why it tries to use 'ITW2012Mobile.Models.AllowedDate' and how to fix it?
I use the latest version of EF.
[ADDED]
My connection strings:
<add name="DefaultConnection" connectionString="data source=(local);initial catalog=JSAVIP;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="ITW2012Entities" connectionString="metadata=res://*/Models.DB.csdl|res://*/Models.DB.ssdl|res://*/Models.DB.msl;provider=System.Data.SqlClient;provider connection string="data source=(local);initial catalog=JSAVIP;Integrated Security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
<add name="TexEntities" connectionString="metadata=res://*/Models.TEX.csdl|res://*/Models.TEX.ssdl|res://*/Models.TEX.msl;provider=System.Data.SqlClient;provider connection string="data source=(local);initial catalog=fsmf2012;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
call a second model:
TexEntities _dbContextTex;
_dbContextTex = new TexEntities();
var a = (from i in _dbContextTex.AllowedDateTexes select i).ToList();
(on third string I get the error "Additional information: Could not find the conceptual model type for 'ITW2012Mobile.Models.AllowedDate'.")
defined AllowedDateTex etc:
namespace ITW2012Mobile.Models
{
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
public partial class TexEntities : DbContext
{
public TexEntities()
: base("name=TexEntities")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
public DbSet<AllowedDateTex> AllowedDateTexes { get; set; }
public DbSet<AllowedTimeTex> AllowedTimeTexes { get; set; }
}
}
namespace ITW2012Mobile.Models
{
using System;
using System.Collections.Generic;
public partial class AllowedDateTex
{
public AllowedDateTex()
{
this.AllowedTimes = new HashSet<AllowedTimeTex>();
}
public int DayID { get; set; }
public System.DateTime Day { get; set; }
public virtual ICollection<AllowedTimeTex> AllowedTimes { get; set; }
}
}
namespace ITW2012Mobile.Models
{
using System;
using System.Collections.Generic;
public partial class AllowedTimeTex
{
public int TimeID { get; set; }
public int DayID { get; set; }
public int Hour { get; set; }
public int Minute { get; set; }
public virtual AllowedDateTex AllowedDate { get; set; }
}
}
EDIT 2:
I decided to remove EF-models at all and recreate it. When I add first EF-model - all is ok. When I add one more with tables, which have the same names, as in first EF-model then classes from first model are recreated!
Thanks

Categories