Compare what files when update the service reference - visual-studio

Say I updated one WCF service, so in the client side I can view the changes by click view history on the service reference node.
My question is if I wonder what are changed between the changesets, what files should I select?
I think that I can select reference.cs to make a comparison. But is it right? There are many other files such as xsd files.

Try to right-click the service reference and view it in object browser. You could see the generated proxy class.
If you want to compare the difference between the updated service reference and the old one, you could generate client proxy class via SVCUtil.exe tool and then check all generated files.
https://learn.microsoft.com/en-us/previous-versions/dotnet/netframework-3.5/aa347733(v=vs.90)
such as,
Svcutil.exe http://localhost:1300/mex /Directory:D:

Related

AsyncCrudAppService Breaks Swagger When Providing TCreateInput and TUpdateInput

I recently downloaded a Single Page Web Application (Angular) from https://aspnetboilerplate.com/Templates using 3.x target version.
I just simply added a few entities and then started to follow the steps on this page https://aspnetboilerplate.com/Pages/Documents/Application-Services
Things do work well for me to Get, List, Update, and Delete entities when my app service class is just inheriting AsyncCrudAppService<Entities.PhoneBook, PhoneBookDto, long, GetAllPhoneBooksInput>, however when it is inheriting AsyncCrudAppService<Entities.PhoneBook, PhoneBookDto, long, GetAllPhoneBooksInput, CreatePhoneBookInput, and UpdatePhoneBookInput> the swagger definition will no longer load.
GitHub Repo: https://github.com/woodman231/MyPhoneBooks
(which currently does not work and will not load Swagger page).
I can get the swagger page to load by removing CreatePhoneBookInput and UpdatePhoneBookInput from
https://github.com/woodman231/MyPhoneBooks/blob/main/aspnet-core/src/MyPhoneBooks.Application/SimpleCrudAppServices/ISimplePhoneBookCrudAppService.cs#L9
and
https://github.com/woodman231/MyPhoneBooks/blob/main/aspnet-core/src/MyPhoneBooks.Application/SimpleCrudAppServices/SimplePhoneBookCrudAppService.cs#L14
However, again I am still unable to create entities using this default implementation. Any ideas?
I have cloned your repo and run it and I figured out the error, first as I tell you in comments I verified the text log, and it said the next:
System.InvalidOperationException: Can't use schemaId "$CreatePhoneBookInput" for type "$MyPhoneBooks.SimpleCrudAppServices.Dtos.CreatePhoneBookInput". The same schemaId is already used for type "$MyPhoneBooks.PhoneBooks.Dtos.CreatePhoneBookInput"
What happenig is that you have these two classes UpdatePhoneBookInput, CreatePhoneBookInput repeated in SanokeCrudAppServices\Dtos and PhoneBooks\Dtos
You have the classes in both folders with same exact name, and thats the problem, if you change the name in whatever place the swagger definition will load without errors, I have do it like this and everything works fine!
Change the name in one of the places, and all will be working fine
Personally I don't like to use a different Dto for Create and Update for me is easier to user just one Dto for all.
Ok I figured it out. I had also made a DIY AppService and some of the DTO Class Names associated with the DIY App Service clashed with the DTO Class Names associated with the Automated Service. It was acceptable in .NET since they were in different name spaces but once the swagger definition was configured I assume that there was multiple instances of the same DTO Defition. I checked the AbpLogs table but they didn't give me much details as to the specifics of the internal server error while loading the definition. It sure would have been useful to know that.

How to access web.config sections in a Web service called from another application?

I'm working on a Web service with Visual Studio, framework 4.7.1. One of its Web methods needs to call another Web service (provided by another company). It converts the parameters it receives (that are consistent with our main application's business logic) into values the other Web service can handle (according to it's own business logic). To do this, it relies heavily on data stored in the Web.config file.
I tested it directly (start the Web service and call the Web methods with automatically generated pages on a Web browser page) and everything worked fine.
Now, I need to build a test application (also in Visual Studio, framework 4.7.1) to call the same Web methods. On first testing it, I noticed that the Web service was trying to access the test application's config file instead of its own (as described in Can't read Web.config with ConfigurationManager.AppSettings ).
So I created an applicationSettings section in the Web.config and moved all the data from appSettings into it. It worked fine.
Now, however, I notice that the same thing happens with the custom sections. One of them looks like this:
<configSections>
<section name="jobTypeLists" type="AdelSoft_WS_FRA.JobTypesSection" />
</configSections>
<jobTypeLists>
<jobTypes>
<jobType codeCustomerType="A" codeJobType="JobForA" />
<jobType codeCustomerType="B" codeJobType="JobForB" />
</jobTypes>
</jobTypeLists>
I can see how such a structure could fit into its own .settings file, but I have another one that is much more complicated. (Like, the text nodes can have up to four ancestors.) To keep this short-ish, I'm not providing it now, but it can easily be arranged.
ConfigurationManager.GetSection("jobTypeLists") returns null when called from the test application. Same with WebConfigurationManager.GetSection("jobTypeLists").
I've also tried accessing the configuration file with ConfigurationManager.OpenExeConfiguration(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile), but I can't seem to find my sections in the Configuration object it returns.
I'm not sure it means anything, but the Configuration object's FilePath property contains "C:\Folder\InnerFolder\WebServiceFolder\web.config.config". Why this second ".config"? I tried passing the same string to ConfigurationManager.OpenExeConfiguration(), without the ".config" extension: it returned null. (As it should, I feel.)
The Configuration object has 10 section groups and 22 sections, which I can't make heads or tails from. Likewise, I can list them.
Actually, there are two ways for a Visual Studio project to reference a Web service: as a regular reference (like you would any other project) or as a Web reference.
I was using the former, and therein lay my mistake.
To reference the Web service, I started it, copied the URL from the browser window that it opened, and pasted it into the "URL" text box in the "Add a Web reference" window from my test application. From there on, it worked fine.
(By the way, I have kept the regular reference as well, because I'm using some constants from the Web service to handle return values.)

Asp.Net Core MVC - Can I move Identity and DataAccess to class library

I have created an ASP.NET Core MVC Web application with Individual User Account authentication (Identity).
The template has created one Web project, with a whole bunch of folders, including a "Data" folder which has the migrations for the Identity schema, and ApplicationDbContext.
Now, I have some other projects alongside the web app which will need to consume the data. I don't want them to reference the web project for obvious reasons.
And ideally I don't want my web project to depend directly on EF.
Can I move the data access into a separate class library? And if so, how!?
Create a class library projects.
Move the content from corewebproject/data to class library projects.
Add following from nuget:
Entity Framework
AspNetCore.Identity
AspNetCore.Identity.EntityFramework
Microsoft.entityframeworkcore.SqlServer
Microsoft.entityframeworkcore.Tools
Microsoft.entityframeworkcore.Tools.Dotnet
Build class library projects.
Add as reference to your web project.
Change reference in startup contextdb file location.
If you want to change you sql server from localdb change defaultconnection in appsettings.
Add reference related files.
Build solutions.
Go to nuget package manager console and select your project.
Run next commands:
'Remove-Migration'. it will remove some file including snapmodel file
Add-Migrations "Name"
update database
Check you database: you can see upadated db with aspnetcore individual account related tables.
!!! Enjoy !!!!
Sure, check out the Dev branch on https://github.com/MachUpskillingFY17/JabbR-Core we just moved all data into a separate library including identity. Its still quite a work in progress, but it absolutely works.

Update Salesforce Web Reference

So I've added a custom field to a Salesforce Object and need to update the Web Reference and proxy classes created from said web reference. What I'm doing is replacing the existing WSDL file in the Web Reference folder with the new Enterprise WSDL file. I then right-click the Web Reference instance (in this case, SFDC) and select "Update Web Reference" however nothing happens. In fact, the updated WSDL file reverts back to its original state and the proxy class file does change at all.
Am I missing a step here?
I actually accomplished this by deleting the web reference, than creating a new one, which added the new field.

Change the connection string in app.config with InstallShield 2011 setup

I'm creating an InstallShield 2011 basic MSI installer project.
I'm trying to change the connection string in my app.config according to the user selections from the database login dialog made in the setup. How can I apply these connection string settings to the connection string entry in the app.config of my windows application I'm trying to install?
XML File Change is the right place to start from. Since changing the connection string is a common task my hope was that there is a best practice to do exactly this task.
-- edit --
There are two main difficulties:
How do I reference a file in InstallShield which will be created on build? The App.config gets copied to MyAppName.config. I don't want to hardwire the application name into the setup at this place again.
The connection string in the config file is used by Entity framework, thus contains more information than given by the database selection from InstallShield. I have to patch an attribute within an element of the config file, if I just want to change the Server and InitialCatalog properties of the connection string. It looks like XML File Change only supports replacing of an entire element or attribute.
As far as I remember, the XML File Changes is designed for this purpose. You can place the user's choice as a property value when defining your XPath and element/attribute values. For me, it was one of the areas of InstallShield which worked quite good and as described.

Resources