草庐IT

entity-system

全部标签

c# - LINQ 或 ADO.net Entity Framework - 学习哪个?

澄清一点:我在浏览JuliaLerman的OreillyEntityFramework标题时感到非常困惑。我有CharlieCalvert的基本LINQ,但是从我与Lerman的书的10分钟session中,它表明LINQ是LINQtoSQL,它的DataContext对象等似乎功能不足......尽管EntityFramework是future,但它有一个叫做EntitySQL的东西,在我看来它看起来与Transact-SQL完全一样。现在我的眼睛可能有点生锈了,但问题是:既然EntityFramework是Microsoft支持的主力,那么学习LINQtoSQL有什么意义吗varn

c# - 使用 System.IO.Packaging 生成 ZIP 文件

我知道通常建议使用DotNetZip或SharpZipLib库之类的库来使用.net语言(在我的例子中是C#)创建ZIP文件,但使用System并非不可能.IO.Packaging生成ZIP文件。我认为尝试在C#中开发一个例程可能会很好,它可以做到这一点,而无需下载任何外部库。有没有人有一个或多个使用System.IO.Packaging生成ZIP文件的方法的好例子? 最佳答案 让我为你谷歌这个->system.io.packaging+generate+zip第一个链接http://weblogs.asp.net/jongallo

c# - .mdf"failed with the operating system error 2(系统找不到指定的文件。)

protectedvoidregister_Click(objectsender,EventArgse){AddUser(userName.Text,password.Text,confirm.Text);}voidAddUser(stringname,stringpass,stringconfirm){Useru=newUser(name,pass,confirm);if(u.Valid){using(vardb=newSiteContext()){db.User.Add(u);db.SaveChanges();}}}}publicclassUser{publicintUserId{

c# - LINQ to Entities 无法识别方法 'System.String get_Item (System.String)' ,

我该如何解决这个问题?这是我的代码:DateTimedtInicio=newDateTime();DateTimedtFim=newDateTime();Int32codStatus=0;if(!string.IsNullOrEmpty(collection["txtDtInicial"]))dtInicio=Convert.ToDateTime(collection["txtDtInicial"]);if(!string.IsNullOrEmpty(collection["txtDtFinal"]))dtFim=Convert.ToDateTime(collection["txtDt

c# - Entity Framework 代码优先 CTP4 默认列值?

我一直在使用EntityFrameworkCTP4研究CodeFirst,您可以使用ModelBuilder来构建您的表列。有没有办法使用ModelBuilder或其他机制为数据库中的列设置默认值?谢谢! 最佳答案 我正在使用构造函数来设置默认值。从来没有让我失望publicclassActivity{[Required]publicDateTimeAddedDate{get;set;}publicActivity(){AddedDate=DateTime.Now;}} 关于c#-Ent

c# - System.Web.Http.ApiController.get_Request() 中缺少方法

我有一个Controller。publicsealedclassAccountsController:BaseApiController{privatereadonlyIDatabaseAdapter_databaseAdapter;publicAccountsController(IDatabaseAdapterdatabaseAdapter){_databaseAdapter=databaseAdapter;}[AllowAnonymous][Route("create")]publicasyncTaskCreateUser(CreateUserBindingModelcreate

c# - 如何从 System.DateTime.Now.Hour 获取 24 小时制?

这个问题不太可能帮助任何future的访问者;它只与一个小的地理区域、一个特定的时间点或一个非常狭窄的情况有关,这些情况并不普遍适用于互联网的全局受众。为了帮助使这个问题更广泛地适用,visitthehelpcenter.关闭10年前。我想从System.DateTime.Now.Hour获取当前小时数0-24。我不确定它是否会返回0-12或0-24之间的整数。我如何确保获得0-24之间的整数?

c# - "Inspecting the state of an object in the debuggee of type System.Reflection.MethodBase is not supported in this context"

我不知道这个错误是什么意思。我使用的是VisualStudioforMac7.5.0社区版。我在带有ASP.NETCore的EntityFramework中使用延迟加载。publicpartialclassAdminUser{publicAdminUser(){RoleAssign=newHashSet();}publicGuidUserId{get;set;}publicstringFirstName{get;set;}publicstringLastName{get;set;}publicstringEmail{get;set;}publicstringUserName{get;s

c# - 单元测试 Windows.Web.Http HttpClient 与模拟 IHttpFilter 和 IHttpContent,MockedHttpFilter 抛出 System.InvalidCastException

我有一个依赖于Windows.Web.Http(Windows10UAP应用程序)中的HttpClient的类。我想进行单元测试,因此我需要“模拟”HttpClient来设置Get-Call应该返回的内容。我开始使用HttpClient使用手写模拟IHttpFilter和IHttpContent进行“简单”单元测试。它没有按预期工作,我在Test-Explorer中收到InvalidCastException。单元测试看起来像:[TestMethod]publicasyncTaskTestMockedHttpFilter(){MockedHttpContentmockedContent

c# - Entity Framework 4.3 beta [Column(TypeName)] 问题,无法创建 xml 类型的列

我知道这是一个测试版(刚刚检查了EF4.3的新版本,它做了同样的事情)发布并且一些功能可能缺失,但我没有看到任何可以解释原因的东西......[Column(TypeName="xml")]publicstringSomeProperty{get;set;}...在使用EF4.3时不再创建xml类型的列(列创建为nvarchar(max)),我已经尝试过EF4.2并且可以很好地创建列。仅供引用,我正在连接到sqlserver2008r2并且还尝试了快速版。我正在使用XML来存储不断变化的数据模式的数据,虽然我知道这将作为字符串传回我需要能够针对sql中的xml数据创建存储过程。我也尝试