草庐IT

bit_data_models

全部标签

c# - 将 System.Data.OracleClient 替换为 Oracle.DataAccess (ODP.NET)

我有一个目前正在使用System.Data.OracleClient的项目,因为它已被弃用,所以我想切换到适用于Oracle11g的ODP.NET最新版本。请让我知道以下步骤是否适合我,或者是否需要某些其他操作才能使其正常工作:删除对SYstem.Data.OracleClient的引用添加对Oracle.DataAccessdll的引用用OracleDbType替换OracleType枚举并将对数据类型的引用从VarChar更新为Varchar2等。 最佳答案 你已经差不多明白了。这是我在执行此操作时遵循的Oracle文章:htt

c# - ProtoBuf-Net 和 Compact Framework 出现 "Invalid field in source data: 0"错误

有人知道使用ProtoBuf-Net在紧凑框架和完整.Net框架之间进行序列化/反序列化时有任何问题吗?我有一个名为LogData的类,我正在compactframework3.5下序列化,传输到服务器(运行.Netframework4.0),然后反序列化。有时它有效,有时它会抛出上述错误,我还没有将其缩小到任何特定原因。我用不同的值做了很多测试,但似乎无法找到错误发生时的任何韵律或原因。我在下面包括我的类(class)(减去各种构造函数)。我已多次查看两侧的字节缓冲区,但尚未发现通过线路从一侧发送到另一侧的数据存在差异。[ProtoContract]publicclassLogDat

c# - 什么是 Microsoft.Practices.EnterpriseLibrary.Data

我想知道什么Microsoft.Practices.EnterpriseLibrary.Data.dll是以及我们使用此程序集的原因。这个dll有什么好处?我想在3层架构上创建一个项目,并且很好奇执行sql查询的最佳方式是什么。我应该使用这个dll还是简单地使用SqlCommand和DataAdapter.目前我正在以这种方式工作:(DAL文件中的代码:)publicvoidInsert(longid){connection.Open();SqlCommanddCmd=newSqlCommand("test_procedure",connection);dCmd.CommandType

c# - 系统.Data.SqlClient.SqlException : Invalid column name 'phone_types_phone_type_id'

我正在尝试从我的一些模型中获取信息,这些模型与我的主要员工模型具有外键关系。如果我单独绘制每个模型,我可以像往常一样毫无问题地访问它们,但我必须访问多个不同的网页才能这样做。我正在尝试将我的几个模型合并为一个Controller,并以这种方式使用它们。不幸的是,当我尝试访问这些模型时,出现了一个奇怪的错误:System.Data.SqlClient.SqlException:Invalidcolumnname'phone_types_phone_type_id'.搜索我的代码后,显然phone_types_phone_type_id出现的唯一位置是在我的迁移代码中。总的来说,我对C#和

c# - MVC 错误 : The model item passed into the dictionary is null

我只是想建立一个View,但我收到以下错误:System.InvalidOperationException:Themodelitempassedintothedictionaryisnull,butthisdictionaryrequiresanon-nullmodelitemoftype'System.DateTime现在,我知道为什么会出现这种情况,数据库中的特定字段是空值,但它应该是空值,因为这是稍后编辑的内容。这是我的代码:ActionpublicActionResultView(Int64?Id){ModelContainerctn=newModelContainer();

c# - 当部分 View 位于共享文件夹中时,ASP.NET MVC '@model dynamic' 无法识别模型属性

不重复:MVCRazordynamicmodel,'object'doesnotcontaindefinitionfor'PropertyName'根据那里的答案,AccordingtoDavidEbbo,youcan'tpassananonymoustypeintoadynamically-typedviewbecausetheanonymoustypesarecompiledasinternal.SincetheCSHTMLviewiscompiledintoaseparateassembly,itcan'taccesstheanonymoustype'sproperties.为什

c# - "Data Source cannot be empty. Use :memory: to open an in-memory database"是什么意思?

我最近将我的SQLServer数据库转换为SQLite数据库。但是当我尝试使用.Open()打开我的SQLite时,它​​抛出了这个错误:DataSourcecannotbeempty.Use:memory:toopenanin-memorydatabase编辑:添加连接字符串:ConnectionString=@"DataSource=D:\XXX.db;Version=3";connection=newSQLiteConnection(connectionString);connection.Open();为什么我会得到这个?我将相同的SQLServer数据库转换为SQLCE和my

c# - 扩展 ASP.NET 身份角色 : IdentityRole is not part of the model for the current context

我正在尝试在我的MVC5应用程序中使用新的ASP.NETIdentity,特别是我正在尝试将ASP.NETIdentity集成到现有数据库中。我已经阅读了有关DBFirst和ASP.NETIdentity的SO问题/答案,并且遵循了所有建议我仍然无法向我的数据库添加角色,尽管我在添加用户时没有问题。这是我的代码:varcontext=newPayrollDBEntities();varroleManager=newRoleManager(newRoleStore(context));boolroleExists=roleManager.RoleExists(roleDto.Name);

c# - 扩展 System.Data.Linq.DataContext

我有一个反射(reflect)我的dbml文件的类,它扩展了DataContext,但由于某些奇怪的原因,它告诉我System.Data.Linq.DataContext'doesnotcontainaconstructorthattakes'0'arguments"我已经按照各种教程进行操作,但没有遇到这个问题,而且VS似乎无法修复它。这是我的实现usingSystem;usingSystem.Collections.Generic;usingSystem.Data;usingSystem.Data.Linq;usingSystem.Data.Linq.Mapping;usingSy

c# - ASP.NET MVC : Views using a model type that is loaded by MEF can't be found by the view engine

我正在尝试创建一个框架,以允许将Controller和View动态导入到MVC应用程序中。到目前为止,它是这样工作的:我正在使用.NET4、ASP.NETMVC3RC和RazorViewEngine每个项目都使用MEF导出和导入Controller-我将给定项目中的一组Controller和View称为“模块”BuildManager使用应用前启动方法和BuildManager.AddReferencedAssembly动态引用使用MEF发现的程序集。使用构建事件将二进制文件(来自导出项目)和View复制到目标项目的文件夹结构中使用自定义Controller工厂选择Controller