Dealing with data is an integral part of any application. .NET development, the structure framework is mainly the preferred data management selection for many developers. The entity framework is an object-relational mapping using the .NET platform to work with relational data that can simplify data access coding.
What is Xamarin?Xamarin is one of the leading
cross-platform implementations of the common language infrastructure (CLI) and
common language specifications. Xamarin developers will apply Xamarin to write
down local Android, iOS, and Windows apps with native users interface and share
code across multiple platforms. Xamarin developers mostly have the options when
deciding what to choose for shared code:
• Shared projects- With conditional compilation and source code
sharing across the .NET platform
• Portable Class Library– Which is used for specified platform
objects
Is Xamarin compatible with
the .NET Standard project?
It all depends upon various
factors. .NET Standard is mainly compatible with many PCL Profiles but only in
one way – it simply means that you can refer to some PCL DLLs in the .NET
Standard project but the reverse is not possible. Practically it is possible
but it can cause your application to be unstable so avoid doing the reverse
process.
Why using Standard Class Library is the better option than the
Shared project in Xamarin Solution?
There are large differences
between using a quality category and quality projects in an Xamarin solution.
The clearest reason appears when you open a XAML file in a Standard class
library, you will get IntelliSense to support; in a shared project, you won’t
get any IntelliSense assistance and virtually every element in your XAML file
will be indicated as an error.
If your Visual Studio doesn’t
support Standard Class Library Projects, in that case, you will require the
Shared Project. But using shared Project in your Xamarin project is not always
the best efficient option. So going with the Standard Class Library is the only
solution. So how will you know which kind of project your solution is currently
using? So first you have to take a look at the icon beside your common project
in Solution Explorer. If the icon is showing the two overlapping diamonds then
your solution is using the Shared project. If you have a simple box with “c#”
inside of it then you have Standard Class Library.
Here is the complete guide for converting the shared project to
standard class Library Project:
• Firstly, right click on your Solution node in Solution
Explorer and use the Add New Project.
• Then click .NET Standard
• Select the class library project (.NET Standard) to add a
Standard class library project per solution.
• After adding the project, delete the default resources in the
project.
• Now drag and drop any resources from your present Shared
project to your new quality category Library project.
• Next option is, make a right-click on your new project and
use Manage NuGet Packages to add the Xamarin.Forms package to your project.
After finishing all these
above steps, now do a rebuild on your new project. If you acquire some compile-time
errors you've got not seen before, open your project’s resources and on the
application tab, confirm that the target framework dropdown the list is ready
to the top level. If it does not happen, then set the dropdown to the highest
level and try another build. If you're still facing compile time issues then
it'll be too early to move to the .NET quality category library project and you
cannot move from your present Shared project.
In the next case, if you do not have a XAML file in your new
project then –
• First of all, Right click on your new project in Solution
Explorer
• Select Add
• New Item
• Xamarin Forums
• Content page to add one
If you like this to be your
begin page, confirm the new name of that page equals the name in the App class
constructor in the App.xaml file.
At last, in the other
projects in your solution, Use add, then the new reference to add a project
reference to your new standard class library project and do a rebuild of your
solution.
Advantages of .NET Standard:
1. .NET standard is a set of APIs that are correctly selected and
known to replaceable
2. .NET comes in versions like from 1.0 to 2.0 and so on
3. A .NET standard is independent of any of them
Conclusion
Using .NET Standard projects for Xamarin projects can be very smooth experience and most of the chances are you will never notice any problems. Even though there are some useful benefits like better dependency structure in Solution Explorer. Hence, Xamarin can be very productive while building apps using asp.net web development and can provide the best user experience to the customers.
Related Articles:
0 comments:
Post a Comment