{"id":3819,"date":"2020-03-17T02:18:56","date_gmt":"2020-03-17T09:18:56","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/odata\/?p=3819"},"modified":"2020-03-20T12:02:52","modified_gmt":"2020-03-20T19:02:52","slug":"odata-connected-service-version-0-5-0-release","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/odata\/odata-connected-service-version-0-5-0-release\/","title":{"rendered":"OData Connected Service version 0.5.0 Release"},"content":{"rendered":"<p><span style=\"font-size: 14pt;\">OData Connected Service 0.5.0 has been released and is available in the <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=laylaliu.ODataConnectedService\">Visual Studio Marketplace.<\/a><\/span><\/p>\n<p><span style=\"font-size: 14pt;\">The new version has the following new features:<\/span><\/p>\n<ol>\n<li><span style=\"font-size: 14pt;\">A new version of the Microsoft.OData.Client library(v7.6.3)<\/span><\/li>\n<li><span style=\"font-size: 14pt;\">Supports mocking of the generated functions and properties.<\/span><\/li>\n<li><span style=\"font-size: 14pt;\">An option to open the generated files in the IDE after code generation.<\/span><\/li>\n<\/ol>\n<p><span style=\"font-size: 14pt;\">In addition to the above features, the new version has the following improvements and fixes:<\/span><\/p>\n<ol>\n<li><span style=\"font-size: 14pt;\">Generation of type definitions using their underlying types.<\/span><\/li>\n<li><span style=\"font-size: 14pt;\">The Microsoft WCF Toolkit dependency has been removed.<\/span><\/li>\n<li><span style=\"font-size: 14pt;\">All features and fixes from OData Client Code Generator are now in OData Connected Service.<\/span><\/li>\n<\/ol>\n<p><span style=\"font-size: 18pt;\"><strong>Microsoft.OData.Client v7.6.3<\/strong><\/span><\/p>\n<p><span style=\"font-size: 14pt;\">OData Connected Service version 0.5.0 comes with <strong>Microsoft.OData.Client v7.6.3<\/strong> which has great improvements: Some of the improvements are:\u00a0<\/span><\/p>\n<ol>\n<li><span style=\"font-size: 14pt;\">Save ODataPath ToList for improved performance.<\/span><\/li>\n<li><span style=\"font-size: 14pt;\">Performance improvements in FunctionOverloadResolver.<\/span><\/li>\n<li><span style=\"font-size: 14pt;\">Fixes for OData.net Client throwing InvalidOperationException when calling &#8216;Move&#8217; on a DataServiceCollection.<\/span><\/li>\n<li><span style=\"font-size: 14pt;\">Fixes for supporting escape function and key values terminating in colon.<\/span><\/li>\n<li><span style=\"font-size: 14pt;\">Fixes for IN operator fails on strings with commas in them.<\/span><\/li>\n<li><span style=\"font-size: 14pt;\">Allow Microsoft.OData.Client.Serializer.GetKeyString to receive an IDictionary Object.<\/span><\/li>\n<li><span style=\"font-size: 14pt;\">Fixes for $filter in (null) not working.<\/span><\/li>\n<li><span style=\"font-size: 14pt;\">Fixes for Combine Dispose methods on JsonWriter.<\/span><\/li>\n<\/ol>\n<p><span style=\"font-size: 18pt;\"><strong>Supports Mocking of the generated functions and properties<\/strong> <\/span><\/p>\n<p><span style=\"font-size: 14pt;\"><span style=\"line-height: 107%; font-family: 'Arial',sans-serif;\">The generated methods and properties can be mocked for purposes of testing your client code. <\/span><span style=\"line-height: 107%; font-family: 'Arial',sans-serif;\">You can use any Mock Framework to mock these methods.<\/span><span style=\"line-height: 107%; font-family: 'Arial',sans-serif;\">The following is a simple example to show that the generated methods can be mocked using the Moq Framework.<\/span><\/span><\/p>\n<pre class=\"nums:false lang:c# decode:true\">public string AddPerson(DefaultContainer defaultContainer)\r\n{\r\n    Person person = new Person\r\n    {\r\n        FirstName = \"PersonA\"\r\n        \/\/\u2026there are many more fields here. \r\n    };\r\n    try\r\n    {\r\n        defaultContainer.AddToPeople(person).\r\n        return \"Saved Successfully\".\r\n    } catch (Exception exception)\r\n    {\r\n        return \"Not Saved Successfully\u201d. \r\n    }   \r\n}\r\n<\/pre>\n<p><span style=\"font-size: 14pt;\">Using the Moq Framework, we can setup the AddToPeople() method to return whatever we want it to return whenever we call it. Like below.<\/span><\/p>\n<pre class=\"nums:false lang:c# decode:true\">public void Return_SavedSuccessfully_WhenAddToPeopleMethodIsCalled()\r\n{\r\n     string response = \"Add\".\r\n     Mock&lt;DefaultContainer&gt; mock = new Mock&lt;DefaultContainer&gt;(null).\r\n     mock.CallBase = true;\r\n     mock.Setup(x =&gt; x.AddToPeople(It.IsAny&lt;Person&gt;())).Callback(() =&gt; { response = \"Saved Successfully\"; });\r\n     Users users = new Users ();\r\n     string result = users.AddPerson(mock.Object);\r\n     Assert.Equal(result, response).\r\n}\r\n<\/pre>\n<p><strong><span style=\"font-size: 18pt;\">An Option to open the generated files in the IDE after code generation <\/span><\/strong><\/p>\n<p><span style=\"font-size: 14pt;\">This option has been added on the OData Connected Service setup wizard. It is on the Advanced Settings page. You can use this setting when you want the generated file to open in the IDE after code generation.To set this option, follow the following steps:<\/span><\/p>\n<p><span style=\"font-size: 14pt;\">If you have the OData Connected Service extension installed,<\/span><\/p>\n<ol>\n<li><span style=\"font-size: 14pt;\">Right click on the project you are working on from the solution explorer.<\/span><\/li>\n<li><span style=\"font-size: 14pt;\">Select <strong>Add-&gt;Connected Service<\/strong> from the context menu.<\/span><\/li>\n<li><span style=\"font-size: 14pt;\">From the Connected Service Window that opens, select the <strong>Microsoft OData Connected Service<\/strong>.<\/span><\/li>\n<li><span style=\"font-size: 14pt;\">On the wizard window, configure your service endpoint by providing the service name and the OData URL endpoint then click Next.<\/span><\/li>\n<li><span style=\"font-size: 14pt;\">On the Next page, click on the \u201c<strong>AdvancedSettings<\/strong>\u201d link.<\/span><\/li>\n<\/ol>\n<p><img decoding=\"async\" class=\"alignnone wp-image-3862\" src=\"https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/snap1-1-300x91.png\" alt=\"Image snap1\" width=\"679\" height=\"206\" srcset=\"https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/snap1-1-300x91.png 300w, https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/snap1-1-1024x311.png 1024w, https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/snap1-1-768x233.png 768w, https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/snap1-1.png 1126w\" sizes=\"(max-width: 679px) 100vw, 679px\" \/><\/p>\n<p><span style=\"font-size: 14pt;\">Check the checkbox beside the \u201c<strong>Open generated files in the IDE when generation completes<\/strong>\u201d configuration on this page then click finish.<\/span><\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-3864\" src=\"https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/snap2-300x205.png\" alt=\"Image snap2\" width=\"666\" height=\"455\" srcset=\"https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/snap2-300x205.png 300w, https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/snap2-1024x701.png 1024w, https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/snap2-768x526.png 768w, https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/snap2.png 1202w\" sizes=\"(max-width: 666px) 100vw, 666px\" \/><\/p>\n<p><span style=\"font-size: 14pt;\">The generated file will open in the IDE once the code generation process completes.<\/span><\/p>\n<p><span style=\"font-size: 18pt;\"><strong>Generation of type definitions using their underlying types.<\/strong><\/span><\/p>\n<p><span style=\"line-height: 107%; font-family: 'Arial',sans-serif; font-size: 14pt;\">The previous versions of OData Connected Service could not generate code for an endpoint whose schema had: <\/span><\/p>\n<ol>\n<li><span style=\"font-size: 14pt;\"><span style=\"font-size: 14pt;\">Elements with type definitions like the Outlook Beta API \u00a0<\/span><\/span>\n<pre class=\"nums:false lang:default decode:true\">&lt;TypeDefinition Name=\"DateTime\" UnderlyingType=\"Edm.String\"\/&gt;<\/pre>\n<\/li>\n<li><span style=\"font-size: 14pt;\"><span style=\"font-size: 14pt;\"><span style=\"font-size: 14pt;\">Functions with parameters whose types are based on type definitions like below:<\/span><\/span><\/span>\n<pre class=\"nums:false lang:default decode:true\">&lt;Function Name=\"MyFunc\" IsBound=\"true\"&gt;\r\n   &lt;Parameter Name=\"StartDate\" Type=\"MyNamespace.DateTime\" \/&gt;\r\n   &lt;ReturnType Type=\"Edm.Int32\" Nullable=\"false\" \/&gt;\r\n&lt;\/Function&gt;\r\n<\/pre>\n<\/li>\n<\/ol>\n<p><span style=\"font-size: 14pt;\">This issue has been solved in the OData Connected Service version 0.5.0. The OData Connected Service can now generate type definitions using their underlying types without any errors or exceptions.<\/span><\/p>\n<p><strong><span style=\"font-size: 18pt;\">All features and fixes from OData Client Code Generator are now in OData Connected Service.<\/span><\/strong><\/p>\n<p><span style=\"font-size: 14pt;\">The OData Connected Service version 0.5.0 is now in sync with the latest version of the Microsoft OData Client Code Generator. All features and fixes in the Microsoft OData Client Code Generator are now available in OData Connected Service.<\/span><\/p>\n<p><span style=\"font-size: 18pt;\"><strong>Removed the Microsoft WCF Toolkit dependency\u00a0.<\/strong><\/span><\/p>\n<p><span style=\"font-size: 14pt;\">The Microsoft WCF Toolkit dependency has been removed from this version. That is, you do not need to install the WCF Toolkit for you to generate client code.<\/span><\/p>\n<p><span style=\"text-align: left; color: #333333; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Segoe UI,'Segoe UI Web Regular','Segoe UI Regular WestEuropean','Segoe UI',Tahoma,Arial,Roboto,'Helvetica Neue',sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol'; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; display: inline !important; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: #ffffff;\">There are more features and fixes coming to OData Connected Service soon, so stay tuned for upcoming releases.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>OData Connected Service 0.5.0 has been released and is available in the Visual Studio Marketplace. The new version has the following new features: A new version of the Microsoft.OData.Client library(v7.6.3) Supports mocking of the generated functions and properties. An option to open the generated files in the IDE after code generation. In addition to the [&hellip;]<\/p>\n","protected":false},"author":12390,"featured_media":3253,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3819","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-odata"],"acf":[],"blog_post_summary":"<p>OData Connected Service 0.5.0 has been released and is available in the Visual Studio Marketplace. The new version has the following new features: A new version of the Microsoft.OData.Client library(v7.6.3) Supports mocking of the generated functions and properties. An option to open the generated files in the IDE after code generation. In addition to the [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/posts\/3819","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/users\/12390"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/comments?post=3819"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/posts\/3819\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/media\/3253"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/media?parent=3819"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/categories?post=3819"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/tags?post=3819"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}