Office App design and architecture - c#

I have a VSTO application designed like a standard windows app that has Data Access Layer, Business Access Layer,Controller and Different views for showing different excel sheets. Its a very big applications.
Now I am trying to convert the VSTO application to Office Apps. I want to use the Business and Data Access layer as lot of work has been done in Business Layer. Data Access Layer is basiacally a EF layer. Buiness Layer
access the Data layer using the repository pattern. I need the some guidance on a best way to appraoch for the design for office apps where I can reuse most of the code.
Will MVC be a good fit in this scenario?

By using SharePoint Provider Hosted App you are able to use a Web Application from a SharePoint site in Office 365, also the Web Application can have access to the site context, you just need to convert your Windows Application into a Web Application and publish it using a Windows Server or if you prefer you can use Azure. I have tested this approach as a SharePoint App but I'm not sure if this or a similar approach can work in Word, Excel and PowerPoint, however you should invest some time researching this, worth the effort.
Here is some good resources that will help you to get involved in the Provider Hosted App development:
http://blogs.technet.com/b/meamcs/archive/2013/02/24/sharepoint-provider-hosted-app-walkthrough-part-1-preparation.aspx
https://msdn.microsoft.com/en-us/library/office/fp142381.aspx
https://auth0.com/docs/integrations/sharepoint-apps
Using Azure:
http://www.sharepointnutsandbolts.com/2013/07/deploying-sp2013-provider-hosted.html
https://msdn.microsoft.com/en-us/library/office/dn343301(v=office.15).aspx

Office Apps and VSTO add-ins are entirely different things. You will not be able to re-use the code due to the fact that Office Apps are written in JS and HTML(+CSS). See Build apps for Office for more information.

Related

How to choose right approach to authentication and authorization

I am building a plugin for multiple .NET based solutions. The application it self will connect to a database that holds user data and user group data, as well as some configuration files that users create for them selves. The configurations may also be shared between users (the owner can share his configurations with another user), and administrators will be able to edit all permissions on all files(my guess is via some web interface).
The applications that will have access to the functionality of this plugin are using the .NET platform but after that the projects diverge. One is using old win forms, the other WPF for desktop and another is web based using a JavaScript library. All the aforementioned applications are just interfaces for a shared lib that contains actual business logic.
My plugin will be implemented within the shared business logic library. The app will support both username and password authentication as well as windows authentication(if win auth fails the all will ask for username and password to try to access data that way).
My options regarding membership and authentication/authorization are plentiful and I'm not sure of my choice. I can use the Membership library or the new Identity library. I am also sure there are 3rd party libs that are quite good at this stuff but I have yet to hear of them.
is there a preferred lib to use or is the choice trivial and i should just start from somewhere?
This is a great place to start: http://brockallen.com/category/membershipreboot/

Azure Web Forms and HTML to PDF converters

If you are using Windows Azure Web Sites for deployment (not Cloud Services) and developing an ASP.net Web Forms application, is it possible to use a 3rd party HTML to PDF converter? I'm starting to think I must convert to a Web Application instead of being a Web Form. I'm kind of new to all of this, so I'd appreciate anyone's input.
If by chance there are 3rd party HTML to PDF converters that are compatible with Web Forms and Azure Web sites, that would be useful. I'm rather happy with the site as-is, but I need to add in the ability to generate a PDF report and I don't fancy tearing up the code if I can avoid it.
Thanks.
Subsequent to my comment 27-dec I had to find a solution and 8 cents per document wasn't an option for thousands of documents. Eventually we build our own solution service http://www.html2pdfrocket.com and made it free.
We pretty much ended up doing exactly what you said - hosting it on Microsoft Azure Cloud Services - as you also discovered the Azure websites didn't have the flexibility or scalability to do what we needed but their cloud services is perfect for it.

Adding SharePoint screen to legacy c# application

We have an Enterprise application written in C# that we well to customers. The server runs in our data center and the customers connect via a windows application also written in C#. Pretty standard.
Management would like a dashboard added to our application. I was told to look into using sharepoint to somehow add a sharepoint dashboard to the main screen of our client application (winforms).
Is this possible? The client application would have to somehow show a web page from the sharepoint server which I guess is no problem using a html componenent. But I'm more worried about getting sharepoint to work with our existing data (sql server 2008).
I suggested just writing the dashboard ourselves and avoiding sharepoint. But management would like to add more 'Business Intelligence' to our application. I know that is the way of the future but I'm worried about the complexity of integration with sharepoint.
There are various options for integrating SharePoint into a windows forms application. The simplest is embedding a web browser control and point it to the page with the dashboard set up.
Alternatively you could use the SharePoint client object model (2)(make calls to the SharePoint server) and retrieve data (and potentially pages) from SharePoint to put into your dashboard.
I would recommend to management that we can display SharePoint through our current application, and we can demonstrate with a simple dashboard part (eg chart control) to demonstrate how we can make the dashboard integrate more naturally over time piece by piece. This would minimise risk by displaying from SharePoint, while being able to show the potential advantages of using the SharePoint data and creating a customised windows forms dashboard.
SharePoint does a good job of going either way with information via BCS, assuming you would want to show LOB data in a SharePoint deployment.
However, since you want to go the other way, the Client Object Model works well with this. Seeing as how it is a .NET application, I can site specific times where we have used the built in REST services to get information from lists in our enterprise SharePoint deployments.
Security will need to be addressed as well, so don't forget about that. If you have AD groups already set up for your enterprise application, you can most likely reuse some of those in SharePoint. If you don't, you will have to now manage how data will be secured. You may also end up getting prompted for a log in to SP which is never a good user experience.
Good luck!

Best Practices for Exchanging data between Desktop and Web Application

I have to pass information from a desktop application to Web application and vice versa.
What are the best practices that are regularly used?
Currrently I'm using Asp.Net and a Winforms.
To pass data to Web Site im creating a (POST) WebRequest and posting an xml to the site.
To pass data to Application im using .Net Remoting from Asp.net
(I'm using Winforms is an adminstration and monitoring application.)
Edit: Lets treat it as a generic web app and winforms.
Also currently both Web app and Winforms are on the same machine.(but can change).
Web Services or Windows Communication Foundation (WCF) would be your best bets for remote interoperability.
On your website, expose some service end points and consume them from your desktop app. Then send messages as you require.
I'd look hard at the design of the system and consider whether it's necessary to use a Winforms application at all for monitoring and administration. No, really: creating rich Web sites is quite straightforward (if necessary, with technologies like AJAX) and the architecture of the resulting application will be much, much simpler.
And, of course, deployment is then really simple.
I am not sure if there is a best practice for what you are trying to accomplish. There might be some security concerns you have to think about when allowing posts to your web application however. It would be very easy for a potential attacker to manipulate the post data and send it to your web application. You should consider using web services or Windows Communication Foundation.
Register a custom handler like how Real player registers rstp:// or for that matter web browsers register http://

View need to go Winform to Webform, what is your advices?

Our application is well structured (well we did our best!) and we have split the Model from the View, Now, we need to let some information to our client with a web access. We would like to build something small with IIS and some webform.
Here some information you might think are useful:
Our controller have Thread of database queries
Our database is PostGresql
All is build with C#2.0
We used a lot of databinding between our View and Controller in Winform.
Winform will stay for internal purpose, only a small part will be available on the Internet.
What are your suggestions for this kind of move?
Update
We will host the web in our company server so the database will stay inside the business. No need to duplicate data or any synchronization.
I think the "synchronizing" Michael is talking about is the data in the database and the view presented by the Winform app.
We had a similar problem, and the solution we came up with is to create a Web service that exposes the data via XML and use the service from both the web app and Winform app. Every time you update data send it to the web service, and every time you perform a query get the latest data from the service. Do not consider caching data on the Winform app unless you have profile data showing it is a bottleneck, or you want to run unconnected from the network.
This is perfectly possible in .Net 2, you do not need 3.0 or WCF.
The biggest challenge is going to be synchronizing your database between the local Winforms application and the hosted Webforms application. Once you do that, creating the web app is easy.
If your web application is read only, then you can set up replication. Find a tool that you like. Three that I found through a quick search are:
Slony-I
Mamoth Replicator
Bucardo
If your web application is not read only, then the problem is more difficult. You might want to consider upgrading to .NET 3.0 or 3.5 so you can use WCF. If there is a significant overlap in functionality, you might want to move your data to the web exclusively and expose it through WCF services.

Categories