query-expressions

Extended computation expressions without for..in..do

梦想与她 提交于 2019-12-03 04:15:16
问题 What I mean by extended computation expressions is computation expressions with custom keywords defined via CustomOperation attribute. When reading about extended computation expressions, I come across very cool IL DSL by @kvb: let il = ILBuilder() // will return 42 when called // val fortyTwoFn : (unit -> int) let fortyTwoFn = il { ldc_i4 6 ldc_i4_0 ldc_i4 7 add mul ret } I wonder how the operations compose without using for..in..do construct. My gut feeling is that it starts with x.Zero

Extended computation expressions without for..in..do

人走茶凉 提交于 2019-12-02 16:41:48
What I mean by extended computation expressions is computation expressions with custom keywords defined via CustomOperation attribute. When reading about extended computation expressions , I come across very cool IL DSL by @kvb: let il = ILBuilder() // will return 42 when called // val fortyTwoFn : (unit -> int) let fortyTwoFn = il { ldc_i4 6 ldc_i4_0 ldc_i4 7 add mul ret } I wonder how the operations compose without using for..in..do construct. My gut feeling is that it starts with x.Zero member, but I haven't found any reference to verify that. If the example above is too technical, here is

CRM 2011 KeyNotFoundException exception

南笙酒味 提交于 2019-12-02 02:01:53
I am new to CRM development. I have a Custom Entity "customer". This Entity has a Field called "defaultcustomer", which can be TRUE or FALSE. I am working on a Plug-In where i need to set the "defaultcustomer" to FALSE for all the "Customers". I am doing it as below: FACTS: I have registered the plugin for the entity "customer" itself. So when the Entity "customer" is updated, the plugin fires. private void MakeAllNonDefault() { try { QueryExpression query = new QueryExpression("customer"); query.ColumnSet = new ColumnSet("defaultcustomer"); EntityCollection retrieved = service

What should be used instead of the deprecated EntityName.account.ToString()?

戏子无情 提交于 2019-12-01 20:57:46
When I design a QueryExpression , I've always used the following, hard-coded syntax. QueryExpression expression = new QueryExpression { EntityName = "account"; ... } In this blog the following syntax based on this enumeration is used. QueryExpression expression = new QueryExpression { EntityName = EntityName.account.ToString(); ... } I liked it much better but I couldn't find it using intellisense. Then I've found this discussion where it's explained that the syntax is deprecated. So, what should one use instead of EntityName ? I've googled it a bit but can't find anything useful. It seems to

What is the difference between LINQ query expressions and extension methods

风格不统一 提交于 2019-11-29 21:55:21
Below are two queries that return the same data. Other then style I am not sure which is better. What factors influence these queries? What are the benefits of using one style over the other? Sample 1 var x = from s in db.Surveys join sq in db.Survey_Questions on s.ID equals sq.Survey_ID join q in db.Questions on sq.Question_ID equals q.ID join qg in db.Question_Groups on q.ID equals qg.Question_ID where s.Type_ID.Equals(typeID) & s.Type.Equals(type) select new { question = sq.Question, status = sq.Status, grp = qg }; Sample 2 var x = db.Surveys.Where(s => s.Type_ID.Equals(typeID) & s.Type

How do you compose query expressions in F#?

二次信任 提交于 2019-11-29 19:59:55
I've been looking at query expressions here http://msdn.microsoft.com/en-us/library/vstudio/hh225374.aspx And I've been wondering why the following is legitimate let testQuery = query { for number in netflix.Titles do where (number.Name.Contains("Test")) } But you can't really do something like this let christmasPredicate = fun (x:Catalog.ServiceTypes.Title) -> x.Name.Contains("Christmas") let testQuery = query { for number in netflix.Titles do where christmasPredicate } Surely F# allows composability like this so you can reuse a predicate?? What if I wanted Christmas titles combined with

Case insensitive QueryExpression

本小妞迷上赌 提交于 2019-11-28 09:25:47
问题 Is it possible to build a query with a ConditionExpression which is not case sensitive ? ConditionExpression condition = new ConditionExpression() { AttributeName = "lastname", Operator = ConditionOperator.BeginsWith, Values = new ObservableCollection<object>() { searchName } }; In this example I would like the search with searchName to be case insensitive. 回答1: I believe that this is a factor of the database collation that was chosen during install of CRM rather than a feature of

Implementing goMongoDB-like Query expression object evaluation

◇◆丶佛笑我妖孽 提交于 2019-11-28 08:29:09
I've been looking for a MongoDb-like ( http://docs.mongodb.org/manual/applications/read/#find , docs.mongodb.org/manual/reference/operators/ ) query expression object evaluation function implementation or a class. It may cover not all the advanced features, and should have extensible architecture. MongoDB-like query expression objects are easy for understanding and usage , providing ability to write clean, self-explaining code, because both query and objects to search in, are associative arrays. Basically talking its a convenient function to extract information from php arrays. Knowing the

How do you compose query expressions in F#?

纵饮孤独 提交于 2019-11-27 09:37:43
问题 I've been looking at query expressions here http://msdn.microsoft.com/en-us/library/vstudio/hh225374.aspx And I've been wondering why the following is legitimate let testQuery = query { for number in netflix.Titles do where (number.Name.Contains("Test")) } But you can't really do something like this let christmasPredicate = fun (x:Catalog.ServiceTypes.Title) -> x.Name.Contains("Christmas") let testQuery = query { for number in netflix.Titles do where christmasPredicate } Surely F# allows