草庐IT

right_table

全部标签

c# - Entity Framework 代码优先 : How can I create a One-to-Many AND a One-to-One relationship between two tables?

这是我的模型:publicclassCustomer{publicintID{get;set;}publicintMailingAddressID{get;set;}publicvirtualAddressMailingAddress{get;set;}publicvirtualICollectionAddresses{get;set;}}publicclassAddress{publicintID{get;set;}publicintCustomerID{get;set;}publicvirtualCustomerCustomer{get;set;}}一个客户可以有任意数量的地址,但

C#.NET : Acquire administrator rights?

是否可以在C#.NET应用程序中请求Windows7PC上的管理权限?我希望能够通过ClickOnce部署应用程序,并让用户使用它来执行管理任务(在本例中,它正在为主应用程序编写注册表项)。 最佳答案 http://victorhurdugaci.com/using-uac-with-c-part-1http://victorhurdugaci.com/using-uac-with-c-part-2http://victorhurdugaci.com/using-uac-with-c-part-3*self提升额外的字符,因为它必须

c# - ITextSharp : Set table cell border color

如何设置表格单元格的边框颜色。这是我的代码://createanddefinetablevartable=newPdfPTable(8);table.HorizontalAlignment=Element.ALIGN_CENTER;//table.HeaderRows=1;//thecellobjectPdfPCellcell;varf=FontFactory.GetFont("Tahoma",11,Font.BOLD);cell=newPdfPCell(newPhrase("SourceReview",f));cell.BorderColorLeft=newBaseColor(255

c# - 流利的 nHibernate : Use the same mapping files for tables with the same structure in different schemas

这是我的映射类:classMyTableMap:ClassMap{publicMyTableMap(){Schema("mySchema");Id(x=>x.id);Map(x=>x.SomeString);}}这适用于我的第一个数据库中的表([mySchema].[MyTable])。但是这个表(“MyTable”)存在于(实际上很多)不同的数据库中,但是由于任何原因,模式总是被命名为不同的(我无法控制):因此在数据库“OtherDB”中有表[SomeOtherSchema].[MyTable],其结构与第一个数据库中的[mySchema].[MyTable]相同。出于显而易见的原因

c# - T-SQL : Lock a table manually for some minutes

这个问题在这里已经有了答案:ForcingaquerytimeoutinSQLServer(4个答案)关闭8年前。我知道这会很奇怪,但我想在我的MVC应用程序中触发一个错误,这个错误将基于LINQ查询,我想从表中获取一条记录。虽然此记录将使用T-SQL命令(例如无限循环始终更新此记录)在(数据库/表/行)级别被阻止,但我的LINQ查询将执行查询以读取该记录。当LINQ尝试时,结果应该是20-30秒后超时,以前有人试过吗?

c# - 使用 Table Per Hierarchy 继承在 LINQ to Entities 查询中转换为派生类型

我有一个LINQtoentities模型,它具有TablePerHierarchy继承。我对基类型有一个查询,我想做特定的类型相关逻辑。例如:IQueryablebase=...//thisworksfinevarresult=base.Select(b=>bisDerivedType1?1:2).ToList();//thisdoesn'tcompiletoSQLvarresult2=base.Select(b=>bisDerivedType1?((DerivedType1)b).DerivedProperty:null).ToList();有没有办法在不单独处理每个派生类型的IQu

c# - 系统参数异常 : The table type parameter must have a valid type name

我正在尝试将用户定义的表类型传递到C#中的查询中。类型定义为2列(组织和子组织)我的代码是这样的:DataSetds=newDataSet();try{DataTableFilteredOrgSubOrg=newDataTable("OrgSubOrgValueType");FilteredOrgSubOrg.Columns.Add("org",typeof(string));FilteredOrgSubOrg.Columns.Add("subOrg",typeof(string));FilteredOrgSubOrg.Rows.Add(org,orgsub);using(SqlCon

c# - 将 Windows 窗体应用程序带到前台的 "right"方法是什么?

我正在用C#编写一个Windows窗体应用程序。我需要能够将它带到前台。经过一些谷歌搜索和实验后,我得到了一个看起来很老套的可行解决方案。如果有的话,我想知道执行此操作的优雅方法。我需要应用程序恢复并回到前台,无论它是最小化的,还是未最小化但在后台的。当前代码如下所示:WindowState=FormWindowState.Minimized;WindowState=FormWindowState.Normal;BringToFront();Focus(); 最佳答案 你试过了吗Form.Activate?这段代码似乎可以做你想做的

c# - Entity Framework 错误 : Cannot insert explicit value for identity column in table

我在EF上遇到这个错误。Cannotinsertexplicitvalueforidentitycolumnintable'GroupMembers_New'whenIDENTITY_INSERTissettoOFF.Db上的列是标识增量,在EF设计文件上,StoreGeneratedPattern也是标识。似乎每次我尝试保存时EF都试图插入0。一些建议说ID保留在表上或删除表并重新运行脚本。有什么想法吗?这是一些代码:GroupMembergroupMember=newGroupMember();groupMember.GroupId=group.Id;groupMember.Use

c# - Entity Framework ALTER TABLE 语句与 FOREIGN KEY 约束冲突

在EntityFramework中更新数据库时,代码优先迁移,我收到此错误:TheALTERTABLEstatementconflictedwiththeFOREIGNKEYconstraint"FK_dbo.Clients_dbo.MedicalGroups_MedicalGroupId".Theconflictoccurredindatabase"hrbc",table"dbo.MedicalGroups",column'Id'.这是我的课:publicpartialclassClient{[Key,DatabaseGenerated(DatabaseGeneratedOption