草庐IT

Multilingual_entity

全部标签

c# - 如何在 Entity Framework 6(代码优先)中调用存储过程?

我是EntityFramework6的新手,我想在我的项目中实现存储过程。我有一个存储过程如下:ALTERPROCEDURE[dbo].[insert_department]@Name[varchar](100)ASBEGININSERT[dbo].[Departments]([Name])VALUES(@Name)DECLARE@DeptIdintSELECT@DeptId=[DeptId]FROM[dbo].[Departments]WHERE@@ROWCOUNT>0AND[DeptId]=SCOPE_IDENTITY()SELECTt0.[DeptId]FROM[dbo].[De

c# - Entity Framework 。删除表中的所有行

如何使用EntityFramework快速删除表中的所有行?我目前正在使用:varrows=fromoindataDb.Tableselecto;foreach(varrowinrows){dataDb.Table.Remove(row);}dataDb.SaveChanges();但是执行时间比较长。还有其他选择吗? 最佳答案 对于那些像我一样在谷歌上搜索并最终来到这里的人,这就是你目前在EF5和EF6中的做法:context.Database.ExecuteSqlCommand("TRUNCATETABLE[TableName]

c# - Entity Framework 。删除表中的所有行

如何使用EntityFramework快速删除表中的所有行?我目前正在使用:varrows=fromoindataDb.Tableselecto;foreach(varrowinrows){dataDb.Table.Remove(row);}dataDb.SaveChanges();但是执行时间比较长。还有其他选择吗? 最佳答案 对于那些像我一样在谷歌上搜索并最终来到这里的人,这就是你目前在EF5和EF6中的做法:context.Database.ExecuteSqlCommand("TRUNCATETABLE[TableName]

c# - 关联的主体端在 1 :1 relationship in Entity framework 中意味着什么

publicclassFoo{publicstringFooId{get;set;}publicBooBoo{get;set;}}publicclassBoo{publicstringBooId{get;set;}publicFooFoo{get;set;}}当我收到错误时,我正试图在EntityFramework中执行此操作:Unabletodeterminetheprincipalendofanassociationbetweenthetypes'ConsoleApplication5.Boo'and'ConsoleApplication5.Foo'.Theprincipalend

c# - 关联的主体端在 1 :1 relationship in Entity framework 中意味着什么

publicclassFoo{publicstringFooId{get;set;}publicBooBoo{get;set;}}publicclassBoo{publicstringBooId{get;set;}publicFooFoo{get;set;}}当我收到错误时,我正试图在EntityFramework中执行此操作:Unabletodeterminetheprincipalendofanassociationbetweenthetypes'ConsoleApplication5.Boo'and'ConsoleApplication5.Foo'.Theprincipalend

c# - Entity Framework 5 更新记录

我一直在探索在ASP.NETMVC3环境中编辑/更新EntityFramework5中的记录的不同方法,但到目前为止,它们都没有勾选我需要的所有框。我会解释原因。我发现了三种方法,我将提及它们的优缺点:方法1-加载原始记录,更新每个属性varoriginal=db.Users.Find(updatedUser.UserId);if(original!=null){original.BusinessEntityId=updatedUser.BusinessEntityId;original.Email=updatedUser.Email;original.EmployeeId=updat

c# - Entity Framework 5 更新记录

我一直在探索在ASP.NETMVC3环境中编辑/更新EntityFramework5中的记录的不同方法,但到目前为止,它们都没有勾选我需要的所有框。我会解释原因。我发现了三种方法,我将提及它们的优缺点:方法1-加载原始记录,更新每个属性varoriginal=db.Users.Find(updatedUser.UserId);if(original!=null){original.BusinessEntityId=updatedUser.BusinessEntityId;original.Email=updatedUser.Email;original.EmployeeId=updat

SpringBoot——单元测试error: can not execute. because can not find cache of TableInfo for entity!

问题  单元测试时,遇到以下报错:com.baomidou.mybatisplus.core.exceptions.MybatisPlusException:error:cannotexecute.becausecannotfindcacheofTableInfoforentity! atcom.baomidou.mybatisplus.core.toolkit.ExceptionUtils.mpe(ExceptionUtils.java:49) atcom.baomidou.mybatisplus.core.toolkit.Assert.isTrue(Assert.java:38) atco

google-app-engine - 为什么在 Go AppEngine aetest 中使用 datastore.Property List 获取 datastore.Put 的 "invalid entity type"?

此测试失败并显示partnermerge_test.go:22:datastore:invalidentitytypepackagebigdipperimport("testing""appengine/aetest""appengine/datastore")funcTestCreateMigrationProposal(t*testing.T){c,err:=aetest.NewContext(nil)iferr!=nil{t.Fatal(err)}deferc.Close()if_,err:=datastore.Put(c,datastore.NewKey(c,"ORDER","

google-app-engine - 为什么在 Go AppEngine aetest 中使用 datastore.Property List 获取 datastore.Put 的 "invalid entity type"?

此测试失败并显示partnermerge_test.go:22:datastore:invalidentitytypepackagebigdipperimport("testing""appengine/aetest""appengine/datastore")funcTestCreateMigrationProposal(t*testing.T){c,err:=aetest.NewContext(nil)iferr!=nil{t.Fatal(err)}deferc.Close()if_,err:=datastore.Put(c,datastore.NewKey(c,"ORDER","