I am currently testing oData client in combination with Dynamics AX 7. The metadata file coming from AX is over 900'000 lines big and if i use the default oData client and auto generate a C# class file it won't build because of too many string literals (.net error).
Now i'm looking for a way to tell the client generator which classes to generate (by entity name for example) and which not (about 95% isn't needed on the client-side).
Sadly limiting the metadata on AX side is not an option.
We had a similar issue, where we had to modify the available $metadata information from an ODATA service.
In our case we used the DataServiceContext generator and pointed to the original server URI but used Fiddler as a Proxy inbetween. By using a breakpoint in Fiddler we could serve our modifed $metadata xml to the DataServiceContext generator in Visual Studio. Works fine when you used sparingly and if the API is stable.
Yes using VS2015 will solve your "too many strings" error, but you will still have a problem where Visual Studio 2015 will crash if you open the huge file that is generated or accidentally step into the oData client file while debugging.
To get around this issue, I edited the T4 templates which auto-generate the oData client classes so that they create multiple files, so you do not end up with one huge 1 million+ line file. Using the updated T4 templates, it will generate the same code, but will split into a new file every 5MB.
The updated T4 templates can be found here:
https://github.com/batetech/D365FO-oData-T4-MultiFile-Templates
Related
I am using Razor templates (cshtml) to build HTML for use in emails. While I can get this all to work and I can send email from a ASPNetCore 3.0 web application I want to actually send email from another process which is NOT a web application. Ideally I would like to queue email, which can be triggered from any number of backend processes, and then send those from a timer like service which runs as a windows service or possibly a back-end worker running in Azure via something like Functions.
Is there any way to leverage razor templates from within a RCL in a .NetCore console or other application which is NOT hosted in AspNetCore??
I think there isn't a way to do this i am sry. :(
If I understand your question correctly, you can use RazorEngine, which I used in .NET Framework 4.6.2 Class Library. There is a .Net Core Nuget as well.
I referenced such Class Library projects from Console Applications, Windows Services and Azure Cloud Services (Worker Roles).
In my setup, I had to mark Razor files as Content so they are copied over to the bin folder. Also, it got more complicated if library is referenced by another library and then that library is used; content did not get copied over or it got flattened out (all razor views ended up in the root of the bin folder vs following directory structures), for which there is a fix by editing project file and adding your own copy build tasks. Or I had to embed razor views into DLL.
There might be improvements to this in recent years, as I said I used RazorEngine few years back. And it might be different in .Net Core RCL as well, but I believe it is possible.
Nowadays, I am using 3rd party services like SendGrid or MailJet. For me, using them avoids majority of the above issues and offers better insight into emails/templates/campaigns to Marketing and other non-tech users. They can edit and modify templates to their liking without (m)any code deployments.
You have to run the code through ASP.net core engine so that Razor code get converted into html.
Otherwise use simple html template.
Resharper auto-completes/hints and verifies file paths when I am in a Razor template and type an image tag's src attribute. However, throughout my ASP.net application I have many methods that take a String that represents a path to a file. Is there any way that I can enable this same verification and auto-completion functionality for those strings?
I am using VS 2013, Resharper 8.1, along with ASP.net MVC, and Web Essentials.
What you're asking can be solved by applying ReSharper's Code Annotations to your helpers! I recently recorded a webinar with JetBrains called ReSharper Secrets, where I talk in depth about Annotations, and actually show how to do the very thing you're asking! (around 32 minutes in)
Basically, you need to apply the [PathReference] attribute on the string parameter of your helper methods that represents the path, and you're done! I wrote a blog post about how to do it, you can read it here.
After some research, I understand that we can use sql server reporting in an mvc application as long as the view engine is web form instead of razor.
The tutorial I have been trying to follow is:
Creating an ASP.net reporting using Visual Studio 2010
The problem is in Part 2. I cannot find the local classes listed as Data Source. The only choice is to set up a new xsd file to connect to the database. How can I have my reports to use my data repositories as their data source?
The credit goes to TNCodeMonkey!
Not only the project has to be compiled first, we must have an index.aspx file in the root folder of the MVC Web Application.
I don't know why. But the Data source is populated with all my dll's once that magic file is in place.
I'm using schema-first web service development approach by hand-coding WSDL/XSD and then feeding it to svcutil tool to generate .NET data and service contracts. I've tried to introduce WS-Addressing into my WSDL by including "UsingAddressing" element both directly into binding and as WS-Policy import. Policy import is ignored, but I get the following error, when "UsingAddress" is included directly into WSDL binding: "WSDL extension element "UsingAddressing" from namespace 'http://www.w3.org/2006/05/addressing/wsdl' was not handled".
According to MSDN, "UsingAddressing" element is supported by WCF (http://msdn.microsoft.com/en-us/library/ms996497.aspx), so is it so, that this element is not supported by svcutil?
For anyone coming across this, I had the same problem trying to generate a proxy with svcutil. I had to generate the proxy via VS2017 and it worked.
I'm signed up, I've downloaded sample code, I've got a WSDL...and yet I have no idea how to get this stuff into my existing .Net application. The WSDL was in a zip file, not a URL so I can't just "Add Web Reference." I've run the wsdl tool from the .Net command prompt, and it made a nice class for me...yet dropping that into my web_reference folder doesn't give me any kind of instantiatable class.
I know I'm missing something stupid. Can someone point me in the right direction please?
The proper way to load the FedEx API WSDL file in Visual Studio 2010:
Open the Solution Explorer
Right click your project
Click 'Add Service Reference'
Click the 'Advanced...' button
Click the 'Add Web Reference...' button
Enter the exact path to the WSDL file for the specific FedEx web reference you're using. For example, I extracted mine to the root of my C:\ drive, so all I entered into the URL field was "C:\ShipService.wsdl" without quotes. If you leave quotes, it won't work.
When you hit go, Visual Studio should consume the wsdl into workable classes for you. Click Add Reference and enjoy!
Note: Make sure you read the FedEx documentation well - a lot of their services have gotchyas and implementation can be a nightmare. For example, their address validation service is consumed incorrectly and creates two-dimensional arrays in Reference.cs where they shouldn't exist - this is detailed in the documentation. Worse yet, the fact that they don't allow address validation on their dev environment isn't documented anywhere! Good luck!
Actually, you can just "Add Web Reference". Give the path to the URL.
OTOH, you should be doing all new web service development (even client development) using WCF. Microsoft now considers ASMX web services to be "legacy technology".
BTW, I just tried using their address validation service, and it won't work with .NET. Both ASMX and WCF clients will attempt to use the XML serializer to consume this service, and there is a bug there that prevents that service from being used.
Matt, the WSDL zip file has the WSDL and its associated transactions for that service. Unzip the file and then "Add the reference" to the WSDL in your code.
Try changing the namespace of the proxy class to that of your application. I currently use the proxy class with C# and it works in spite of FedEx's limited documentation and samples.