Entity Framework code first database is not created
Hello,I am currently working on this tutorial to learn ASP.net...
View ArticleJson and Entity Framework Cannot return from multiple table
HelloI have several tables which I read the data from them and set it into a View Class All of models are defined as IList expect the EmployeeProfile Table. I have relation between Employeeprofile and...
View ArticleFirst time After Inserting a data to the Data base the Navigation properties...
Hi!When I am inserting data into the empty table and retrieving the data the Navigation property is null.Eg. I have a table called Inventory and it has a Navigation properties called Type and...
View ArticleHow EF can capture return message or data from store procedure
here is a example of store procedures which return data so many different wayjust return value -------------------- CREATE PROCEDURE GetMyInt ( @Param int) AS DECLARE @ReturnValue int SELECT...
View Articlenullable parameter in linq with && operator . How?
fuction void GetBookingSearchCoures(SearchBookingResponse model, int userId, string language, int? _personId = null)bookingSearches = from uc in _dataContext.V_ENT_BOOKINGS where uc.USER_ID == userId...
View ArticleEF invalid column name "PayAmount" - and ongoing EF misery
I have added a single column called "PayAmount" to an existing table (Transactions) with datatype money Allow Nulls to my local and remote dbs.Everything the same.On the local machine in the EF diagram...
View ArticleHow to execute two EF linq query with one db round trip
when we work with ado.net then we can pass multiple sql separated by comma. here is one example.SqlConnection connection = new SqlConnection(); SqlCommand command = new SqlCommand();...
View ArticleSum column with Linq to sql
I have a table Subscriber with columns (Int)ID, (int)Fee, (unt)Bid I want to sum column Fee in my table where Bid == x How to do this with Linq to Sql c#? Thanks in advance
View ArticleHow to ignore or stop creating table from class EF code first
suppose i have a employee class and i want when i will migrate or run our project then EF will not create employee table. so is there any attribute which i can use for a class to ignore it?i found...
View ArticleEager loading does not work with virtual property
just read this link http://foreverframe.net/when-use-include-with-entity-framework/see this imagedoes the above error is occurring for virtual keyword?if yes then it will be big problem because when...
View ArticleEF eager loading: How include works
just see the codevar company = context.Companies .Include(co => co.Employees.Select(emp => emp.Employee_Car)) .Include(co => co.Employees.Select(emp => emp.Employee_Country))...
View ArticleEF code first for existing db and model class
when we work with EF code first with existing db then we have to write c# class which represent db table. so tell me when we write class then do i need to mention fields as PK or FK when table already...
View ArticleHow EF include works and join
i heard EF include do the left join to fetch data from table with one round trip. my question is how include understand which class it will use to join.suppose this is my model classespublic class...
View ArticleReturn multiple props using Find
var project = Context.Single<Project>(p => p.ProjectCode == projectCode, p => p.WorkItems, p => p.Notes, p => p.Resources);How can I do the same using...
View ArticleHow to annotate EF model class for the equivalent of HasMany, WithOptional...
see the full below code.public partial class TestModel : DbContext { public TestModel() : base("name=TestModel") { } public virtual DbSet<Department> Departments { get; set; } public virtual...
View ArticleRegarding a EF linq query
see the below codeusing (var context = new SchoolDBEntities()) {var stud1 = (from s in context.Students.Include("Standard") where s.StudentName == "Student1" select s).FirstOrDefault<Student>();...
View ArticleEntity Framework configuration
this is my dbcontext public partial class TestModel : DbContext { public TestModel() : base("name=TestModel") { } public virtual DbSet<Department> Departments { get; set; } public virtual...
View ArticleEF code first and FK mention
just view this link http://www.learnentityframeworkcore.com/configuration/data-annotation-attributes/foreignkey-attributepublic class Book { public int BookId { get; set; } public string Title { get;...
View ArticleEntity Framework: How to enable paging support for repository pattern
i found a code which seems work. just tell me how use the below code to return paged customer...may be 20 customer. also tell me how to enable sorting.give me a small sample code which fetch customer...
View Article