草庐IT

the_string

全部标签

c# - 如何创建一个空的 IOrderedEnumerable<DynamicNode> 和 IEnumerable<IGrouping<string, DynamicNode>>

我需要一种方法来创建一个空的IOrderedEnumerable和IEnumerable>//以上IGroupingDynamicNode被stackoverflow剥离:(原因:我创建了3个空列表类型(IOrdered、IGrouping、IEnumerable),然后基于一些其他信息(用户指定的选项,例如按创建日期排序或按月分组),然后调用一个函数来分配一个列表属于上述类型。(简短片段)//DOESNTWORKTHISISTHEPARTINEEDIEnumerablebaseList=Enumerable.Empty();IOrderedEnumerableorderedList=

c# - 玻璃映射器 : InferType is ignored when querying the SitecoreContext

我已经在我的Sitecore7.1解决方案上安装了Glass.Mapper.Sc.CaSTLeWindsor版本3.1.2.11包,并尝试使用推断类型。我有以下类(class):[SitecoreType]publicclassServiceConfiguration{[SitecoreField(FieldName="ServiceId")]publicvirtualstringServiceId{get;set;}}[SitecoreType(TemplateId="{26512C19-8D30-4A1E-A2CD-3BA89AF70E71}")]publicclassJavasc

c# - 无效的 URI : The Authority/Host could not be parsed from very long url

这是Youtube视频的实际url,此时如果您复制到您的chrome浏览器,您可以观看该视频。但是,当我尝试创建请求时,我得到了UriFormatException。我做错了什么?HttpWebRequestrequest=(HttpWebRequest)HttpWebRequest.Create(url);http:/r6---sn-x5jjxnn-ogul.googlevideo.com/videoplayback?ratebypass=yes&ms=au&fexp=924615,912522,932260,910207,936330,916611,936117,936910,93

c# - 如何在 Fluent NHibernate 中映射 IDictionary<string, Entity>

我有一个带有IDictionary的类。如您所见,它使用多对多从其表中获取CodedExamples,使用tOwnedCodedExample表查找哪些属于OwnerClass。我意识到这是一个非常基本的(希望是标准的)映射,但我正在苦苦挣扎,找不到任何文档,因此非常感谢任何可能的帮助。非常感谢斯图 最佳答案 我有一个工作示例,这应该让您清楚。类:publicclassCustomer:Entity{publicIDictionaryFavouriteBooks{get;set;}}publicclassBook:Entity{pu

c# - NHibernate 如何查询 IList<string> 属性?

我正在尝试使用NHibernate查询我的一个域类上的IList属性。这是一个简单的例子来演示:publicclassDemo{publicDemo(){this.Tags=newList();}publicvirtualintId{get;set;}publicvirtualstringName{get;set;}publicvirtualIListTags{get;set;}}像这样映射:而且我能够很好地保存和检索。现在查询Tags属性包含指定值的域类的实例:vardemos=this.session.CreateCriteria().CreateAlias("Tags","t")

c# - Entity Framework 给出异常 : "The underlying provider failed on Open."

我有一个测试。发生的情况是,无论何时首先执行test1,test2都会失败并显示消息:"System.Data.EntityException:System.Data.EntityException:theunderlyingproviderfailedonopen.cannotopendatabase"DBEntities"requestedbythelogin.Theloginfailed.".只要先执行test2,test1就会失败并显示相同的消息。过去3天我一直在处理这个问题。[TestClass]classMyTestClass{DBEntitiesdb;[TestIniti

c# - IIS 7.x,添加启用 HTTPS 的站点 : SiteCollection. Add(string, string, string, byte[]) 重载

我需要以编程方式添加一个IIS7.x站点,但在默认情况下应使用HTTPS/SSL绑定(bind)创建该站点时,我卡住了,使用SiteCollection.Add(string,string,string,byte[])overload.将https:*:80:test.localhosthttps:*:443:test.localhost作为bindingInformation抛出ArgumentException并显示以下消息:指定的HTTPS绑定(bind)无效。这个绑定(bind)信息有什么问题?谢谢。编辑:我正在使用Microsoft.Web.Administration程序集

c# - EventLogReader 和 EventRecord : Where's the Message?

我想查询远程机器上的应用程序事件日志,我求助于使用EventLogReader而不是EventLog因为它需要很长时间才能找到事件我需要EventLog。然而,尽管使用EventLogReader可以更快地找到事件,但我还是无法弄清楚我需要的信息在这个对象上到底在哪里……尤其是消息。publicstaticvoidLoad(){stringquery="*[System/Provider/@Name=\"SQLSERVERAGENT\"]";EventLogQueryelq=newEventLogQuery("Application",PathType.LogName,query);e

c# - EF lambda : The Include path expression must refer to a navigation property

这个问题在这里已经有了答案:EF:Includewithwhereclause[duplicate](5个答案)关闭5年前。这是我的表达:Coursecourse=db.Courses.Include(i=>i.Modules.Where(m=>m.IsDeleted==false).Select(s=>s.Chapters.Where(c=>c.IsDeleted==false))).Include(i=>i.Lab).Single(x=>x.Id==id);我知道原因是模块部分的Where(m=>m.IsDeleted==false),但为什么会导致错误?更重要的是,我该如何修复它

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

我已经使用Entityframework执行了一个linq查询,如下所示GroupMastergetGroup=null;getGroup=DataContext.Groups.FirstOrDefault(item=>keyword.IndexOf(item.Keywords,StringComparison.OrdinalIgnoreCase)>=0&&item.IsEnabled)执行此方法时出现如下异常LINQtoEntitiesdoesnotrecognizethemethod'Int32IndexOf(System.String,System.StringCompariso