UI in n-tier c# - n-tier-architecture

Good day,
I am having trouble with using n-tier architecture.
here's my problem
I want to create a simple n-tier web based application i already added the DAL which comes from our previous project together with the BAL. now i added a project just to hold my my UI. i want to reuse the DAL and the BAL from our previous project. when i add the existing project (both the DAL and BAL) to my web application project, everything run smoothly. i already reference their dll respectively.
I already created the database path on my webconfig and use that path in my application. when i create a method that will extract the record of of my table, in my UI. there's no problem but when i generate my the method that was created in UI. the generated method was not in the BAL project but it is generated in BAL metadata. is there any problem with my UI project?
thanks

Related

Whats a good pattern for a web-application for serving files?

I am working on an angular Web-Application where it's possible to view pdf-files in a pdf-viewer in the browser.
The Web-Application is also consuming a REST-Service in Django.
In the Database the information of the pdf-files is stored. The Web-App is calling the REST-API to check where the files are stored.
As I am still in the Proof-Of-Concept Phase of the project, the PDF-Files are currently stored in the assets folder of the angular web, which of course is not what I want in the end.
When the Files or the Directories change, the Database should be updated automatically (or via a trigger in the app).
I have two questions:
Is there an obvious way to serve the files in this combination? i.e. an apache server? I imagine there are built in solutions in dedicated file servers to detect changes of the watched directory.
For a partly solution would it be reasonable to write a script on the django site, which does the file-serving, the updating and also providing the REST-API?

import projects in build path for web service: server or client?

I have created a little example app to test out the CN1 web service functionalities. Following the web service tutorial from CN1 (https://www.codenameone.com/how-do-i---access-remote-webservices-perform-operations-on-the-server.html), I have my Codename one project as client and a dynamic web project running on my Eclipse tomcat server hosting the servlet.
As I have objects that I pass back and forth between client and server, I want both projects to know about these java files. The way to do that is to put the file in one project, and modify the build path of the other to include the first project. This way, the import can resolve the file name just fine.
Question now is: is it better to put the files in one project or the other? Does either way affect the size of the resulting app file that I want to publish in a store? I want to keep the size as small as possible.
Thanks for any tips.
UPDATE: on the preliminary information provided by Shai, files that are to be shared among different projects (either client or server side), do not put your code in either but INSTEAD create a CN1 library for that. This library can then be added to the CN1 buildpath configuration (not the Java build path!) to all required projects.
Here are the details on how and why: https://www.codenameone.com/blog/new-preliminary-library-support.html
Just need to figure out how to do this on Eclipse, as it does not seem to be supported now.
You can use shared code with a cn1lib whose source you can include into the server project manually. In some cases we just copy the shared source files in the build script from one project to the other as it makes the process simpler.

Can I force Jersey framework to scan only one package while creating WADL?

I have a project where I have kept web service in two separate package. One package contain customer face web services and another contains in house usage web services. I want jersey to only scan the customer facing package and generate WADL.
In general I was not able to find any way to split wadl generation logic by configuration. But here is hack you can perform. There is class called GenerateWadlTask.java This basically does the wadl generation logic for jersey. You can just extend this class in your custom application wadl generation task and use it as per your logic. For code example just download the jersey server source jar and look at the class. The logic is pretty straight forward.
hope this help.
EDIT:- There is a maven plugin called enunicate http://enunciate.codehaus.org/
That will make your life easy.

How can I add a web service project using Visual Studio 2010?

I don't want WCF, I only want web service.
Thank you.
They've obscured it, but it's easy enough:
Right-click on your solution, select Add New Project.
In the Framework selection dropdown, select .NET Framework 3.5
Select the Web installed templates listing and you'll find ASP.NET Web Service Application as the last one in the list.
In other words, you can create one in .NET 3.5, but not 4. Now, that being said, it seems like it may be possible to create a .NET 4 template for VS2010, but I'm not a VS2010 guru, so that's for someone else to elaborate on.
Edited to Add: Somebody else posted a response to your question that was also a good answer, I thought, but they deleted it themselves for some reason. I don't remember their user name. I'll repeat it here.
If you create a new Web Application in the solution, you can then Add New Item, and one of the options under Web is "Web Service" at the very bottom.
The only drawback to this is that besides the web service, you also have the usual default items for a web application, namely default.aspx, about.aspx, global.asax, and site.master, as well as the folders Account, Scripts, and Styles. But you can delete these, so no problem. Also keep in mind that the web.config in the Web Application project will be different from that of the Web Service, and that the assembly bindings for the web service will point to ASP.NET v2 & v3.5 (see its web.config), whereas the service in the web application project will default to ASP.NET v4 (through its project file). I don't know if any negative implications exist for either way of working, though I suspect that both will work just fine.
If you select the framework like mentioned above to 3.5 you can select a web service application. If you want it to be targeted at .NET 4.0 framework, go into my project --> Compile --> Advanced Compile Options --> change the target framework to .net framework 4.
You can also change your compile options to target it at a x64 or x86 (32 bit) server.
web.config in the Web Application project will be different from that of the Web Service, and that the assembly bindings for the web service will point to ASP.NET v2 & v3.5 (see its web.config), whereas the service in the web application project will default to ASP.NET v4 (through its project file). I don't know if any negative implications exist for either way of working, though I suspect that both will work just fine.
Here was my resolution:
Right-click on your project name and select to Add Service Reference.
Select the Advance button at the very bottom.
Select the Add Web Reference button at the very bottom.
Proceed as usual. :)

web service references - dynamic URL

I am currently working on a SharePoint project that needs to use the Lists SharePoint web service (Lists.asmx). Therefore, we need to add a service reference to it in Visual Studio. However, we all develop and test on different virtual machines (with different VM names, URLs, etc.). The QA, Test and Production environments all have different names and URLs as well.
Adding a service reference adds a bunch of references to the URL that was specified when the reference was created (in the app.config. .wsdl, .disco, etc.). This is obviously a problem for us as code that works on one machine won't work anywhere else (which breaks the build and continuous integration) We also have to delete and add the service reference every time we work with code that was checked-in by someone else.
This must be a fairly common problem for people developing Web services so I wondered if there was a way around it. I know you can't really create a "dynamic" web reference, but perhaps the impacts of the URL change could be minimized somehow?
Thanks!
By default, the web-service uses the location where it was initially created. The WebService proxy has a URL property which can be set.
This example shows setting it dynamically: http://www.codeproject.com/KB/XML/wsdldynamicurl.aspx
EDIT:
You're also not limited to using the Add Web Reference feature in Visual Studio. You can use the wsdl.exe tool that ships with the .NET Framework SDK to generate the code file.