Windows Time Zone Identifiers not supported in .NET 6 Blazor WASM - timezone

According to
https://devblogs.microsoft.com/dotnet/date-time-and-time-zone-enhancements-in-net-6/#time-zone-conversion-apis,
with .NET 6 we should be able to use both IANA and Windows Time Zone identifier formats.
However this doesn't work in Blazor WASM (client side), where only IANA format seems to be recognized.
Does anyone know if this is the intended behaviour or a bug or a WIP?

It is by design as this issue (GitHub issue) tells. When passing data between Blazor and JavaScript, every data get serialized and passed and then de-serialized to use in other runtime (Marshalling). .Net DateTimeOffset only can be get from IANA format in JSON Deserialization ("2020-05-21T02:33:11.188+01:30"):

Related

How to define Actions in LightSwitch ODATA and use them from LightSwitch HTML client

my first question on StackOverflow, so apologies if not perfect right from the beginning ...
My question is actually two-fold:
Can I have the LightSwitch ApplicationData service (or any other internally defined Data Source) define ODATA actions on the service level or entity set/entity level? If yes, how do I do that? (I cannot find the route information in the application where I could override/add that.)
How would I consume these actions from the client side (via the built-in MS JS object model in msls or via screen/entity)? Even, if LightSwitch itself could not create/would not support actions, I would still like to know how to consume them from the client side, as we are exposing external ODATA data sources via LightSwitch to the client (and these ODATA source have actions defined).
I know I can use jaydata from the client side to consume that and execute actions on an ODATA source, but I would like to know if LightSwitch has built-in support for that.
Further information: we are using VS/LS 2013. And Silverlight is not an option, we only use the HTML client.
Thank you very much for your support and hints!
Regards, Ronald
There is nothing built-in to LightSwitch that lets you define custom OData actions on the service side or consume them from the client side. You'd need to use standard web functionality like ASP.NET's WebAPI and your favorite JavaScript OData library, like JayData.

delphi web service gets different datetime from .net mvc application

I know the solution most would suggest is to change the properties of my objects from TDateTime to String, but I do not have access to all of the source code for the web service application, so there are cases where I cannot do that. So I'd rather just ensure I take care of the issue.
Briefly, I have a .NET MVC application that calls a web method of a service application written in Delphi 2005 to obtain an appointment object, including start date/time and end date/time. The user can make changes to the appointment, then the MVC app calls another web method, passing in the modified appointment object, for the service application to store.
The StartTime and EndTime properties of the TAppointemnt are defined in Delphi as TDateTime. They appear in the WSDL as xs:dateTime. Visual Studio creates them as System.DateTime in the Reference.cs.
By using the Web App Debugger in Delphi, and setting the endpoints of the MVC app to the web service EXE, I can step through both applications in real-time. What I am seeing is that the StartTime and EndTime properties of sent and received Appointment objects are the same when passed from the web service to .NET MVC, but that the times are adjusted by 13 hours when passing from the .NET MVC to the Delphi web service.
While I understand .NET does some internal timezone adjustments, that should only be apparent when the client and server are in different timezones. In my case, the client browser, .NET MVC app and the Delphi service app are in the same one. In fact, they all run on the same machine, so I am at a loss as to why the difference.
It does look like they encode the datetimes in XML differently...
The RESPONSE from the Delphi service app to the .NET MVC app:
<StartTime xsi:type="xsd:dateTime">2012-10-29T08:00:00.000+13:00</StartTime><EndTime xsi:type="xsd:dateTime">2012-10-29T09:15:00.000+13:00</EndTime>
The POST from .NET MVC app to the Delphi service app:
<StartTime xsi:type="xsd:dateTime">2012-10-29T08:00:00</StartTime><EndTime xsi:type="xsd:dateTime">2012-10-29T09:15:00</EndTime>
I found a solution that works for me.
In my model, where I process the update to the appointment, I am passed an appointment object generated by the view component, which does not include all properties. Only those on the view. To complete the appointment, I get the unchanged version from the service application and modify its properties based on the new object.
What I found when debugging was that the StartTime and EndTime properties of the wsAppointment retrieved from the service application had a DateTimeKind of Local, while the StartTime and EndTime of the pAppointment parameter were set to Unspecified. So the Local DateTimeKind that I was passing back to the service app was being overwritten with Unspecified.
To fix this, I used DateTime.SpecifyKind to explicitly set the Kind property, as follows:
wsAppointment.StartTime = DateTime.SpecifyKind(pAppointment.StartTime, DateTimeKind.Local);
wsAppointment.EndTime = DateTime.SpecifyKind(pAppointment.EndTime, DateTimeKind.Local);
Hope this helps out others that are experiencing the same or similar problems.

Rest webserver using webbroker in BDS2006

Could you give me a tip on how can implement a rest webserver using just webbroker?
I know newer versions of delphi has this REST/JSON/DATASNAP features, but i´m stuck with BDS2006.
Basically i need to interact with other application and the guys are asking me to make this webserver application and provide just five methods over the internet/vpn. Don´t need to be running inside IIS or Apache.
I´ve googled a lot but the answers always point to 2010 and up versions. All that readings lead me to use the webappdebug template make some actions and respond to GET/POST/PUT/DELETE with some JSON objects.
The problem is ... I´m not well versed with webbroker, how can i achive this?
THANKS IN ADVANCE, ANY HELP WILL BE WELLCOME.
Our full RESTful Client-Server framework is availble, including an ORM (and much more), named mORMot.
It is an Open Source project, running from Delphi 6 up to XE2 - so it will work with Delphi 2006 (I've tested it with Delphi 7 and 2007 so I do not see any reason why BDS 2006 would fail).
It is able to serve Objects and Services (just like DataSnap) using JSON, in a secured (using per URL authentication) RESTful protocol.
It is able to use any Database engine back-end, with a SQLite3 kernel. You can even use without any database layer at all (that is without SQLite3), if you need only the RESTful services and in-memory objects feature (you can persist the objects with JSON or in binary format, but you won't be able to use advanced features like cross-table search).
More than 700 pages of documentation available.
For HTTP/1.1 communication, it is not based on WebBroker (nor IIS, nor Apache), but it will use directly the high-speed http.sys kernel-mode service.

Access Windows Search index using ASP.NET MVC

I'm on a project that is being upgraded from vbscript to ASP.NET MVC. It used Microsoft Index Server to index Word and PDF files on a Windows Server 2003 machine. It simply opened an OleDbConnection using a connection string like "Provider=\"MSIDXS\";Data Source=\"docSearch\";".
After researching a bit, I learned that Index Server is obsolete ("Note Indexing Service is obsolete as of Windows XP. Instead, use Windows Search." - http://msdn.microsoft.com/en-us/library/ms690580) and Windows Search is the successor.
So, in my new MVC app, I'm trying to connect using OleDbConnection with a connection string like "Provider=Search.CollatorDSO;Extended Properties=\"Application=Windows\"".
I have a method that takes in a formatted query and executes the search - here is the query that gets executed using OleDb:
string.Format("SELECT System.FileName FROM SystemIndex WHERE CONTAINS('{0}')", query)
Now, when I call my method in a test class, it works fine (i.e. returns results... myDataReader.HasRows is true). But, when I call the same method from my MVC Controller, it returns no results - myDataReader.HasRows is false - using the same query. My guess is something to do with permissions and IIS not being able to access the index. How can I get IIS to have access to the index? How can I expose the index to a ASP.NET web page? If Index Server is obsolete, and this functionality isn't supported in Windows Search, what am I supposed to use?
I would not change just because it is not supported unless you are having a specific problem with Indexing Service or need a feature from the newer version.
I would get connection string from ISearchQueryHelper
Does the service have the correct permissions? Have you checked the Windows Search 3.0/4.0 SDK?
I see you are on the forum (http://social.msdn.microsoft.com/Forums/en-US/windowsdesktopsearchdevelopment/thread/7b9eead4-d938-42c6-ba2b-2c238a7706f9)
I am not sure Windows Search can really replace Indexing Service for Web sites. For instance, there is only one index called "SystemIndex" which contains everything on the local system. Therefore, how would you limit the results to just a Web site?
I believe you need to use "enterprise search" or "search server", which I have no experience with.
Since the results for both Indexing Service and Windows Search are ADO.NET, the presentation does not change much. The API is different enough that you will need to make many changes. For instance, there is no "scope" in Windows Search. When I changed over my personal "desktop search" application, it took an hour to make the change, but two days to duplicate all the functionality that I had with Indexing Service because of the API changes. I made this change because Windows Search is better when searching for code snippets in my "Code Library"
For standard queries with no regular-expressions or wild-cards or non-standard properties, both perform the same. Indexing Service always retrieves data quicker, but may not perform some queries that are "too expensive". Windows Search can take a long time retrieving the data depending on the query. Typically, these "long queries" are the "too expensive" queries of Indexing Service. "Long queries" can also result from any query that retrieves a property that is not contained in the index.
I am still using Indexing Service for my web sites on Windows Server 2003 and do not plan to make any changes because it is not as easy as I expected and there is no compelling reason to do.
I found my answer here ASP.NET OLEDB code breaks when deployed on IIS7. By impersonating a user that has access to the index.

Consuming an ADO.NET Data Service from a WIN32 Delphi application. How?

Simple. I created a LINQ-TO-SQL Entity model, created a website, added a Data Service (*.svc) to this site and made sure it works by writing a simple .NET console application. The service works fine and cannot be modified.
Now I'm going to write a Delphi application (2007) for WIN32 which will have to call this data service. And while Delphi has no major problems importing a SOAP service, it can't import this service since it provides no WSDL...
So, two options. I could figure out how to generate a WSDL based on this data service or I'll have to find another way to consume this service. (Or just give up, but I hate to quit this challenge.) So, any advise?
ADO.NET Data Services are REST services. They are not SOAP WebServices and I don't think REST uses WSDL. You can call REST services from Delphi using HTTP GET/PUT/POST/DELETE. You could use Indy's TIdHTTPClient. See http://msdn.microsoft.com/en-us/library/cc668786.aspx for url examples. The results are in the Atom format, which is a XML format. You could parse it with TXMLDocument. They can also return JSON.
Maybe you can use the project Jedi "url grabber" components to consume the service. I have managed to get live share data using these in the past. I do not know exactly how your setup works, but maybe these can be helpful.
http://www.delphi-jedi.org/
You should also look at synapse, a small easy to use library which works well with REST. The latest version, which can be downloaded via SVN, works well in Delphi 2009.

Resources