zzz projects Entity Framework 6 EF 6
Home EF Core 5 Articles Knowledge Base Online Examples
  • Home
  • EF Core 5
  • Articles
  • Knowledge Base
  • Online Examples

Entity Framework 6 - Knowledge Base (KB)

29 results for: in tag: data-annotations

Validate data using DataAnnotations with WPF & Entity Framework?

Is there any way to validate using DataAnnotations in WPF & Entity Framework?
.net data-annotations entity-framework validation wpf
asked by Shimmy

Custom validation with Data annotations

I'm using data annotations to check data that's being entered, but I'm stuck when it comes to more custom way to validate data....I need to run queries against database to see if stuff exists there or not, and then report back to user if a "custom db-chec...
asp.net-mvc data-annotations entity-framework
asked by Lasse Edsvik

Server-side validation of a REQUIRED String Property in MVC2 Entity Framework 4 does not work

I'm trying to get server-side validation of an Entity Framework String Property to work. Other server-side validation such as data type validation and required dateTime and numeric EF properties are working. ...This in VS 2010, .Net 4.0, MVC2 + Cloud, ADO...
asp.net-mvc data-annotations entity-framework
asked by HackITMngr

Data Annotations [Required] attribute on property of split Entity Data Model

I'm using the ...Table Splitting... feature of the Entity Framework to split my Entity Data Model as follows:...+--------+ +--------------+ | News | | NewsImages | +--------+ +--------------+ | NewsID | | NewsID | | Text | | Ima...
asp.net-mvc c# data-annotations entity-framework
asked by Marius Schulz

How do I specify that a property should generate a TEXT column rather than an nvarchar(4000)

I'm working with the Code First feature of Entity Framework and I'm trying to figure out how I can specify the column data types that should be created when the database is auto-generated....I have a simple model:...public class Article { public int A...
c# data-annotations ef-code-first entity-framework sql-server-ce
asked by Mark Bell

Entity Framework - Default value for property using Data Annotations

I have a model like this...public class MyModel { public int MyModelId { get; set; } public string Name { get; set; } public string Description { get; set; } public string Title { get; set; } } ...I was wondering if there's a way, using Da...
asp.net asp.net-mvc c# data-annotations entity-framework
asked by noinstance

In MVC 3, I can't get @Html.DisplayFor to render a formatted string

I'm hoping this is quite a simple one, although after lots of Googling, I've not been able to work it out....I'm working on a shopping cart site with MVC 3, and using code-first Entity Framework. The model I'm sending over is a list of Product objects, an...
asp.net-mvc c# data-annotations entity-framework linq-to-entities
asked by Matt Winward

using Metadata with Entity Framework to validate using Data Annotation

I have a entity called Product,this is a part of it's declration:...[EdmEntityTypeAttribute(NamespaceName="NorthwindModel", Name="Product")] [Serializable()] [DataContractAttribute(IsReference=true)] public partial class Product : EntityObject { #regi...
c# c#-4.0 data-annotations entity-framework validation
asked by Arian

How to prevent from DataAnnotations Attributes being deleted in DataBase First Model

I have my asp.net mvc 3 application with entity framework and i used the Database First model to set it up....My Steps below: 1. Genarated a database with tables 2. Created ADO.NET Entity Data Model file (.edmx) and imported the tables 3. inside the de...
asp.net-mvc data-annotations database-first edmx entity-framework
asked by python

How to hide Entity Framework entity properties from strongly typed views?

I am using Entity Framework in my ASP.NET MVC 4.0 application and I want to know how to prevent or hide fields from my entity from being generated in my strongly typed view? Right now several primary key fields and timestamp fields are being generated on ...
asp.net-mvc data-annotations entity-framework
asked by atconway

How to make entry field to allow numbers only using EF and Data Annotations?

I am trying to figure out if there is a way to make sure that numeric only input is allowed using Data Annotations and Entity Framework....I am using the following code...[Required] [DisplayName("Client No")] [Column("client_no", TypeName = "smallint")] p...
asp.net-mvc data-annotations entity-framework
asked by Naomi

Data annotations - DisplayFormat - formatting string of numbers

I have the following string: ..."10222002750400447092095835"...I want it to be displayed like this: ...10 2220 0275 0400 4470 9209 5835...I tried doing the following, with no result at all:...[DisplayFormat(DataFormatString = "{0:00 0000 0000 0000 0000 00...
asp.net-mvc asp.net-mvc-3 c# data-annotations entity-framework
asked by ojek

Entity Framework Code First : how to annotate a foreign key for a "Default" value?

I have 2 classes: Client and Survey....Each Client can have many surveys - but only one default survey....I have defined the classes like this:...public class Client { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int ID { get; set;...
data-annotations ef-code-first entity-framework
asked by Colin

Unique Index using Data Annotations

Is there a way to define a Unique Index using Data Annotations?...lets say I have a class:...public class User { [Key] public int UserID { get; set; } public string UserName { get; set; } public string Email { get; set; } } ...If I want Email...
c# data-annotations ef-code-first entity-framework indexing
asked by clifford.duke

Allow empty strings for fields marked with PhoneAttribute or UrlAttribute

I'm using CodeFirst Entitty framework 5. I have a class representing a user....public class User { [Key] public int UserId { get; set; } [Url] [DataType(DataType.Url)] [Required(AllowEmptyStrings= true)] public string WebSite { ge...
c# data-annotations ef-code-first entity-framework validation
asked by Nu-hin

Entity framework data annotation of foreign key without a navigation property

I have the following table definition:...public partial class ClientClassification { [Key, Column(Order = 0)] public long ClientId { get; set; } [Key, Column(Order = 1)] public ClientClassificationEnum ClientClassificationType { get; set;...
c# data-annotations entity-framework entity-framework-6 foreign-keys
asked by TheEdge

Create Foreign Key using Data Annotations

In the code below, I need to set a foreign key constrant on ParentInfoAddProperties.ParentQuestionAnswersId so that it is dependent on ParentQuestionAnswers.Id (which is a Primary Key). I am attempting to do so using data annotations but Entity Framework...
c# data-annotations ef-code-first entity-framework-6 foreign-keys
asked by gemini6609

Entity Framework Code First Foreign Key issue

It seems to me like the ...ForeignKey... attribute is not working for me, but I guess I'm using it wrong ;)...It's easier to explain with code:...public class BaseCard { public int Id {get ; set; } public int BaseCardId { get; set; } public L...
c# data-annotations ef-code-first entity-framework foreign-keys
asked by Rob

Creating 2 sides relationship between a model to the default ApplicationUser of a basic MVC 5 project. Working with 2 dbContext classes

I believe it's suppose to be a trivial issue, but I didn't find any relevant answer....I am working on a MVC 5 project (created by the default VS template with Identity)....I have a Post model. Only an Authorized "user" ("user" is the default Application...
asp.net-identity asp.net-mvc-5 data-annotations ef-code-first entity-framework-6
asked by Dudi

Table name in data annotations in entity framework doesn't work.

I create a project in MVC 5 with entity framework 6. I am using code first approach. I want in one of the models define a different name for the table then the default. For that I use the System.ComponentModel.DataAnnotationsname space and define the clas...
asp.net-mvc data-annotations ef-code-first entity-framework-6
asked by miguelbgouveia

Page 1 of 2
  • 1
  • 2
  • »

Prime Library

Performance

  • Entity Framework Extensions
  • Entity Framework Classic
  • Bulk Operations
  • Dapper Plus

Expression Evaluator

  • C# Eval Expression
  • SQL Eval Function
More Projects...

Related

  • EF Extensions Online Benchmark
  • WIN an EF Extensions license
  • EF6 BatchSaveChanges for only $79
Save your entities 20× faster with EF Extensions
SaveChanges vs BulkSaveChanges

EF Extensions
Try for free now