Xamarin forms and sql server Database - c#

I was working on UWP project in visual studio #xamarin forms, how do i connect to sql Database without using any Web API's and dependency services ?
The application is working in offline mode.

First of all, you must decide whether you want to use Microsoft SQL Server or Sqlite.
These are completely different databases and therefore the code will be different as well.
If you want to use MS SQL, you can use this article.
Somehow from your questions I think that Sqlite will serve you better (just my guess).
If you want to use Sqlite, check this one.
This recipe is designed for Xamarin.Forms PCL project and therefore uses dependency service - since the approach is different on iOS, Android and UWP. If you do not plan to port your project to Android or iOS, you can just call the functions directly, without dependcy service interface.

Related

Is it possible to access the same Firestore collection from both mobile and desktop applications?

I have to deal with a project for which the business needs require a mobile application--built in Flutter; and a desktop application--C# Windows Form App. Both modules are meant to be accessing same collections in the Firebase Firestore, any hints on how it can be achieved? Is there any better alternative for Firestore regarding this use case?
I would suggest using a library like FireSharp or something else.
FireSharp
Your biggest problem will be the update on documents if your application will support multi users.
Additionally, I would use a JSON Library like NewtonSoft.
NewtonSoft Libary
Take a look at the documentation from Google:
Google Documentation
An alternative could be a SQL Server where you flutter app and the c# app access. But Firebase is easier to implement in flutter ... but you need to know if your Database should be SQL, or NoSQL (Firebase).
Yes, it can be achieved, but be careful of editing the same document from different devices at the same time, or you will lose data.
Collections are fine.
You can add a web app in the same Firestore project and both mobile and web will access the same collections. Go to project overview --> project settings and choose add app. From there you can add your web app.
The other option you have is to switch to another database solution like mySQL.

What is the relation between windows services and .Net Framework?

I've studied Windows Services and .Net framework.
From my research, a windows service is a type of application that is primarily used to run in background and can be done automatically or periodically. And
.Net is a software framework developed by Microsoft that runs primarily on Microsoft Windows.
What I would like to know where in the stack of the .Net framework are basically the windows services, supposing windows services use .Net framework.
Any further exaplanation on the relation between these two will be a great help.
Thanks.
They are two completely separate notions. They're related in the way that, for example, a hotel janitorial staff might be related to a guest of the hotel. Just because they reside in the same "building" at some point, doesn't mean there is any "useful" (i.e. substantive for the purposes of comparison given the context) relationship between them, though their paths may cross for whatever reason. The same goes for the notion of windows services and the .NET framework.
Windows services can be written in many languages, including .NET languages. .NET itself has a built-in project template for creating a Windows service.
based on your post:
"windows service is a type of application that is primarily used to
run in background and can be done automatically or periodically"
that is correct, as others mentioned above, you can use any framework to build those services.
Regarding the second portion of your question:
" .Net is a software framework developed by Microsoft that runs
primarily on Microsoft Windows"
Is exactly that, a framework, you can use this framework to create the above mentioned services.
A windows service is just an application that runs without user interaction, .NET is a set of tools you can use to build such applications.
You already have the answer you were looking for.
A service does not have to be written in .NET, anything will do. Two basic things need to happen. First of all, the Service Manager built into Windows needs to know that the service exists. That requires writing a handful of registry keys. Bare essentials are the service name, where the EXE is located and how it should be started. The ServiceInstaller class you write takes care of that, you run InstallUtil.exe to let that installer do its job. Have a look-see with Regedit.exe, navigate to the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services key.
And then the program needs to use a winapi function to talk to the service manager. So that the manager can deliver notifications that tell service to start, stop, pause, etc. That's wrapped by the ServiceBase class, you get friendly methods you can override. Like OnStart(), etc.
That's all there is to it. The service manager takes care of the heavy lifting.
A windows service is a type of application that has been around a long time before .NET.
You can write a Windows Service in many programming languages. You can write a Windows Service in .NET and a language making use of it (C#, VB.NET, etc) but that is not required. You can also use other languages that do not use the .NET framework to write a Windows Service.

Accessing A MySQL Database In Silverlight (C#)

I am trying to access a MySQL database in a Silverlight application. I have tried to reference to System.Data.Services to access the SQLClient class, but it says:
You can't add a reference to
System.Data.Services.dll as it was not
built against the Silverlight runtime.
Silverlight projects will only work
with Silverlight assemblies.
I have also tried to add a reference to MySQL.Data, but received the same error.
I have read online that I will need to use a WebService, but I do not know how to make one.
I am using Visual Studio Ultimate 2010, I am targeting PHP and MySQL servers, not ASP, and would appreciate any help.
Alem, Silverlight is a client-side technology.
It will only work in browsers. You cannot just make direct call to a database from your Silverlight app.
First off, this would be a major security issue you don't want to deal so fortunately you are not even allowed to.
Use webservices, or even better: WCF services.
Try this link: http://chakkaradeep.wordpress.com/2008/05/31/silverlight-and-wcf/
Hope this helps.
you can access sql through php:
http://www.silverlightshow.net/news/PHP-MySQL-and-Silverlight-The-Complete-Tutorial.aspx

Can C# natively talk to Websphere and call wsadmin commands?

I'm writing a small c# console application that needs to interogate Websphere Application Server ND (6.1) to retrieve a list of installed apps.
I can easily do this from the command line using the wsadmin command, but don't really want to launch wsadmin from my c# app.
Is there a way to natively get c# to talk to Websphere and get this sort of information ?
Wsadmin is just a scripting interface for JMX and everything you can do with it can be done with RMI and SOAP. For C# users that means querying for Management Beans via SOAP.
However there are no turn-key solutions available. What has been suggested before has been at least taking a look at the ws-jmx-connector and implementing your own library. You could probably easier just capture one of those queries with ie. SoapUI and replay the SOAP calls. This probably means too much work and that's probably also why there are no ready solutions.
Also, you could just read the XML files that describe the (properly) installed WebSpehre Application Server applications. That is probably much easier, and works just fine. Take a look at the server profile directory. You should see a directory called config, then under it cells, your management cell's name and under that you will find XML files that actually contain every setting you see in the management console. They are well parseable by the standard .NET libraries and a few of those will contain application lists. Take a look at serverindex.xml for instance.

links to sample projects to practice .NET and Oracle technologies

I am planning to practice and learn .NET C#, WCF, ASP.NET web services and Oracle 11g (SQL/PL Sql).
What I am thinking is to work on developing a sample project involving above technologies, so that I can learn technologies at the same type practice them efficiently.
I need guidance to links where I can get some business scenarios or requirements where I can use all the above technologies and implement a sample project.
Thanks in Advance
The first thing I would do is download VMWare Player. It is free and it will allow you to setup a "playground" for you to work with. The next thing I'd do is download Visual Studio Express and install it on your virtual machine. Finally, I would download Oracle 11g which is also free. Install that on your virtual machine too.
Now you have a virtual environment where you can do whatever you want and practice Oracle and .NET to your heart's content without messing up your current system. Once all is setup, you can learn more about Oracle and .NET from the Oracle .NET Developer Center

Categories

Resources