Skip to content

Commit

Permalink
Add nuget readme (#3350)
Browse files Browse the repository at this point in the history
  • Loading branch information
nirinchev committed Jun 17, 2023
1 parent a78f73b commit eca251b
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
82 changes: 82 additions & 0 deletions NuGet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
![Realm](https://raw.githubusercontent.com/realm/realm-dotnet/main/logo.png)

Realm is a mobile database that runs directly on phones, tablets or wearables. It supports all major mobile and desktop operating systems, such as iOS, Android, UWP, macOS, Linux, and Windows. For a full list of supported platforms and their versions, check out the [Supported Platforms](https://docs.mongodb.com/realm/dotnet/#supported-platforms) sub-section in the documentation.

## Features

* **Mobile-first:** Realm is the first database built from the ground up to run directly inside phones, tablets, and wearables.
* **Simple:** Data is directly [exposed as objects](https://docs.mongodb.com/realm/dotnet/objects/) and [queryable by code](https://docs.mongodb.com/realm/dotnet/query-engine/), removing the need for ORM's riddled with performance & maintenance issues. Plus, we've worked hard to [keep our API down to just a few common classes](https://docs.mongodb.com/realm-sdks/dotnet/latest/): most of our users pick it up intuitively, getting simple apps up & running in minutes.
* **Modern:** Realm supports relationships, generics, vectorization and modern C# idioms.
* **Fast:** Realm is faster than even raw SQLite on common operations while maintaining an extremely rich feature set.
* **[Device Sync](https://www.mongodb.com/atlas/app-services/device-sync)**: Makes it simple to keep data in sync across users, devices, and your backend in real-time. Get started for free with [a template application](https://github.com/mongodb/template-app-maui-todo) and [create the cloud backend](http://mongodb.com/realm/register?utm_medium=github_atlas_CTA&utm_source=realm_dotnet_github).

## Getting Started

### Model definition

Define a persistable model by inheriting from `IRealmObject`. The Realm source generator will generate an implementation for most of the functionality, so you only need to specify the properties you want to persist:

```csharp
public partial class Person : IRealmObject
{
[PrimaryKey]
public ObjectId Id { get; private set; } = ObjectId.GenerateNewId();

public string FirstName { get; set; }

public string LastName { get; set; }

public DateTimeOffset Birthday { get; set; }

// You can define constructors as usual
public Person(string firstName, string lastName)
{
FirstName = firstName;
LastName = lastName;
}
}
```

### Open a Realm file

Open a Realm instance by calling `Realm.GetInstance`:

```csharp
// You can provide a relative or an absolute path to the Realm file or let
// Realm use the default one.
var realm = Realm.GetInstance("people.realm");
```

### CRUD operations

Add, read, update, and remove objects by calling the corresponding API on the `Realm` instance:

```csharp
// Always mutate the Realm instance in a write transaction
realm.Write(() =>
{
realm.Add(new Person("John", "Smith"));
});

var peopleWithJ = realm.All<Person>().Where(p => p.FirstName.StartsWith("J"));

// All Realm collections and objects are reactive and implement INotifyCollectionChanged/INotifyPropertyChanged
peopleWithJ.AsRealmCollection().CollectionChanged += (s, e) =>
{
// React to notifications
};
```

For more examples, see the detailed instructions in our [User Guide](https://docs.mongodb.com/realm/dotnet/install/) to add Realm to your solution.

## Documentation

The documentation can be found at [docs.mongodb.com/realm/dotnet/](https://docs.mongodb.com/realm/dotnet/).
The API reference is located at [docs.mongodb.com/realm-sdks/dotnet/latest/](https://docs.mongodb.com/realm-sdks/dotnet/latest/).

## Getting Help

- **Need help with your code?**: Look for previous questions on the [#realm tag](https://stackoverflow.com/questions/tagged/realm?sort=newest) — or [ask a new question](https://stackoverflow.com/questions/ask?tags=realm). You can also check out our [Community Forum](https://developer.mongodb.com/community/forums/tags/c/realm/9/realm-sdk) where general questions about how to do something can be discussed.
- **Have a bug to report?** [Open an issue](https://github.com/realm/realm-dotnet/issues/new). If possible, include the version of Realm, a full log, the Realm file, and a project that shows the issue.
- **Have a feature request?** [Open an issue](https://github.com/realm/realm-dotnet/issues/new). Tell us what the feature should do, and why you want the feature.
2 changes: 2 additions & 0 deletions Realm/Realm/Realm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<DisableFody>true</DisableFody>
<Nullable>enable</Nullable>
<NoWarn>NU5100</NoWarn>
<PackageReadmeFile>NuGet.md</PackageReadmeFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Fody" Version="6.*" PrivateAssets="None" />
Expand Down Expand Up @@ -43,6 +44,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup Label="Package">
<None Include="NuGet.md" Pack="true" PackagePath="\" />
<EmbeddedResource Include="Properties\Realm.rd.xml" />
<None Include="..\Realm.SourceGenerator\bin\$(Configuration)\netstandard2.0\Realm.SourceGenerator.dll" PackagePath="analyzers\dotnet\cs" Pack="true" Visible="false" />
<None Include="wrappers-props\Realm.props" PackagePath="build\Realm.props" Pack="true" Visible="false" />
Expand Down

0 comments on commit eca251b

Please sign in to comment.