├── .editorconfig ├── .github └── workflows │ └── main.yml ├── .gitignore ├── LICENSE ├── ReadMe.md ├── XamarinMultiTenant.Android.Core ├── MainActivityBase.cs ├── Properties │ └── AssemblyInfo.cs ├── Resources │ ├── AboutResources.txt │ ├── Resource.designer.cs │ ├── layout │ │ ├── Main.axml │ │ ├── Tabbar.axml │ │ └── Toolbar.axml │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ ├── mipmap-ldpi │ │ └── ic_launcher.png │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ └── values │ │ ├── strings.xml │ │ └── styles.xml └── XamarinMultiTenant.Android.Core.csproj ├── XamarinMultiTenant.Android.TenantB ├── Assets │ └── AboutAssets.txt ├── MainActivity.cs ├── Properties │ ├── AndroidManifest.xml │ └── AssemblyInfo.cs ├── Resources │ ├── AboutResources.txt │ ├── Resource.designer.cs │ ├── layout │ │ ├── Tabbar.axml │ │ └── Toolbar.axml │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ └── values │ │ ├── colors.xml │ │ ├── ic_launcher_background.xml │ │ ├── strings.xml │ │ └── styles.xml └── XamarinMultiTenant.Android.TenantB.csproj ├── XamarinMultiTenant.Android.TenantC ├── Assets │ └── AboutAssets.txt ├── MainActivity.cs ├── Properties │ ├── AndroidManifest.xml │ └── AssemblyInfo.cs ├── Resources │ ├── AboutResources.txt │ ├── Resource.designer.cs │ ├── layout │ │ ├── Tabbar.axml │ │ ├── Toolbar.axml │ │ └── activity_main.xml │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ └── values │ │ ├── colors.xml │ │ ├── ic_launcher_background.xml │ │ ├── strings.xml │ │ └── styles.xml └── XamarinMultiTenant.Android.TenantC.csproj ├── XamarinMultiTenant.Android ├── Assets │ └── AboutAssets.txt ├── MainActivity.cs ├── Properties │ ├── AndroidManifest.xml │ └── AssemblyInfo.cs ├── Resources │ ├── AboutResources.txt │ ├── Resource.designer.cs │ ├── layout │ │ ├── Main.axml │ │ ├── Tabbar.axml │ │ └── Toolbar.axml │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ ├── mipmap-ldpi │ │ └── ic_launcher.png │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ └── values │ │ ├── Strings.xml │ │ └── styles.xml └── XamarinMultiTenant.Android.csproj ├── XamarinMultiTenant.UWP ├── App.xaml ├── App.xaml.cs ├── Assets │ ├── LockScreenLogo.scale-200.png │ ├── SplashScreen.scale-200.png │ ├── Square150x150Logo.scale-200.png │ ├── Square44x44Logo.scale-200.png │ ├── Square44x44Logo.targetsize-24_altform-unplated.png │ ├── StoreLogo.png │ └── Wide310x150Logo.scale-200.png ├── MainPage.xaml ├── MainPage.xaml.cs ├── Package.appxmanifest ├── Properties │ ├── AssemblyInfo.cs │ └── Default.rd.xml └── XamarinMultiTenant.UWP.csproj ├── XamarinMultiTenant.iOS.Core ├── AppDelegateBase.cs ├── Properties │ └── AssemblyInfo.cs └── XamarinMultiTenant.iOS.Core.csproj ├── XamarinMultiTenant.iOS.TenantB ├── AppDelegate.cs ├── Assets.xcassets │ └── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon1024.png │ │ ├── Icon120.png │ │ ├── Icon152.png │ │ ├── Icon167.png │ │ ├── Icon180.png │ │ ├── Icon20.png │ │ ├── Icon29.png │ │ ├── Icon40.png │ │ ├── Icon58.png │ │ ├── Icon60.png │ │ ├── Icon76.png │ │ ├── Icon80.png │ │ └── Icon87.png ├── Entitlements.plist ├── Info.plist ├── LaunchScreen.storyboard ├── Main.cs ├── Properties │ └── AssemblyInfo.cs ├── Resources │ └── LaunchScreen.xib └── XamarinMultiTenant.iOS.TenantB.csproj ├── XamarinMultiTenant.iOS.TenantC ├── AppDelegate.cs ├── Assets.xcassets │ └── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon1024.png │ │ ├── Icon120.png │ │ ├── Icon152.png │ │ ├── Icon167.png │ │ ├── Icon180.png │ │ ├── Icon20.png │ │ ├── Icon29.png │ │ ├── Icon40.png │ │ ├── Icon58.png │ │ ├── Icon60.png │ │ ├── Icon76.png │ │ ├── Icon80.png │ │ └── Icon87.png ├── Entitlements.plist ├── Info.plist ├── LaunchScreen.storyboard ├── Main.cs ├── Properties │ └── AssemblyInfo.cs ├── Resources │ └── LaunchScreen.xib └── XamarinMultiTenant.iOS.TenantC.csproj ├── XamarinMultiTenant.iOS ├── AppDelegate.cs ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-57x57@1x.png │ │ ├── Icon-App-57x57@2x.png │ │ ├── Icon-App-60x60@1x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-72x72@1x.png │ │ ├── Icon-App-72x72@2x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ ├── Icon-App-76x76@3x.png │ │ ├── Icon-App-83.5x83.5@2x.png │ │ ├── Icon-Small-50x50@1x.png │ │ ├── Icon-Small-50x50@2x.png │ │ └── ItunesArtwork@2x.png │ └── Contents.json ├── Entitlements.plist ├── Info.plist ├── Main.cs ├── Properties │ └── AssemblyInfo.cs ├── Resources │ ├── Default-568h@2x.png │ ├── Default-Portrait.png │ ├── Default-Portrait@2x.png │ ├── Default.png │ ├── Default@2x.png │ └── LaunchScreen.storyboard ├── XamarinMultiTenant.iOS.csproj ├── iTunesArtwork@1x.png ├── iTunesArtwork@2x.png └── iTunesArtwork@3x.png ├── XamarinMultiTenant.sln └── XamarinMultiTenant ├── App.xaml ├── App.xaml.cs ├── Common ├── Colors.cs ├── Constants.cs ├── ITenant.cs ├── Tenant.cs └── Tenants.cs ├── ViewModels ├── MainPageViewModel.cs └── ViewModelBase.cs ├── Views ├── MainPage.xaml └── MainPage.xaml.cs └── XamarinMultiTenant.csproj /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: 2 | http://EditorConfig.org 3 | 4 | # top-most EditorConfig file 5 | root = true 6 | 7 | # Default settings: 8 | # A newline ending every file 9 | # Use 4 spaces as indentation 10 | [*] 11 | insert_final_newline = true 12 | indent_style = space 13 | indent_size = 4 14 | 15 | # C# files 16 | [*.cs] 17 | # New line preferences 18 | csharp_new_line_before_open_brace = all 19 | csharp_new_line_before_else = true 20 | csharp_new_line_before_catch = true 21 | csharp_new_line_before_finally = true 22 | csharp_new_line_before_members_in_object_initializers = true 23 | csharp_new_line_before_members_in_anonymous_types = true 24 | csharp_new_line_between_query_expression_clauses = true 25 | 26 | # Indentation preferences 27 | csharp_indent_block_contents = true 28 | csharp_indent_braces = false 29 | csharp_indent_case_contents = true 30 | csharp_indent_switch_labels = true 31 | csharp_indent_labels = one_less_than_current 32 | 33 | # avoid this. unless absolutely necessary 34 | dotnet_style_qualification_for_field = false:suggestion 35 | dotnet_style_qualification_for_property = false:suggestion 36 | dotnet_style_qualification_for_method = false:suggestion 37 | dotnet_style_qualification_for_event = false:suggestion 38 | 39 | # only use var when it's obvious what the variable type is 40 | csharp_style_var_for_built_in_types = false:none 41 | csharp_style_var_when_type_is_apparent = false:none 42 | csharp_style_var_elsewhere = false:suggestion 43 | 44 | # use language keywords instead of BCL types 45 | dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion 46 | dotnet_style_predefined_type_for_member_access = true:suggestion 47 | 48 | # name all constant fields using PascalCase 49 | dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion 50 | dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields 51 | dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style 52 | 53 | dotnet_naming_symbols.constant_fields.applicable_kinds = field 54 | dotnet_naming_symbols.constant_fields.required_modifiers = const 55 | 56 | dotnet_naming_style.pascal_case_style.capitalization = pascal_case 57 | 58 | # static fields should have s_ prefix 59 | dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion 60 | dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields 61 | dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style 62 | 63 | dotnet_naming_symbols.static_fields.applicable_kinds = field 64 | dotnet_naming_symbols.static_fields.required_modifiers = static 65 | 66 | dotnet_naming_style.static_prefix_style.required_prefix = s_ 67 | dotnet_naming_style.static_prefix_style.capitalization = camel_case 68 | 69 | # internal and private fields should be _camelCase 70 | dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion 71 | dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields 72 | dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style 73 | 74 | dotnet_naming_symbols.private_internal_fields.applicable_kinds = field 75 | dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal 76 | 77 | dotnet_naming_style.camel_case_underscore_style.required_prefix = _ 78 | dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case 79 | 80 | # Code style defaults 81 | dotnet_sort_system_directives_first = true 82 | csharp_preserve_single_line_blocks = true 83 | csharp_preserve_single_line_statements = false 84 | 85 | # Expression-level preferences 86 | dotnet_style_object_initializer = true:suggestion 87 | dotnet_style_collection_initializer = true:suggestion 88 | dotnet_style_explicit_tuple_names = true:suggestion 89 | dotnet_style_coalesce_expression = true:suggestion 90 | dotnet_style_null_propagation = true:suggestion 91 | 92 | # Expression-bodied members 93 | csharp_style_expression_bodied_methods = false:none 94 | csharp_style_expression_bodied_constructors = false:none 95 | csharp_style_expression_bodied_operators = false:none 96 | csharp_style_expression_bodied_properties = true:none 97 | csharp_style_expression_bodied_indexers = true:none 98 | csharp_style_expression_bodied_accessors = true:none 99 | 100 | # Pattern matching 101 | csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion 102 | csharp_style_pattern_matching_over_as_with_null_check = true:suggestion 103 | csharp_style_inlined_variable_declaration = true:suggestion 104 | 105 | # Null checking preferences 106 | csharp_style_throw_expression = true:suggestion 107 | csharp_style_conditional_delegate_call = true:suggestion 108 | 109 | # Space preferences 110 | csharp_space_after_cast = false 111 | csharp_space_after_colon_in_inheritance_clause = true 112 | csharp_space_after_comma = true 113 | csharp_space_after_dot = false 114 | csharp_space_after_keywords_in_control_flow_statements = true 115 | csharp_space_after_semicolon_in_for_statement = true 116 | csharp_space_around_binary_operators = before_and_after 117 | csharp_space_around_declaration_statements = do_not_ignore 118 | csharp_space_before_colon_in_inheritance_clause = true 119 | csharp_space_before_comma = false 120 | csharp_space_before_dot = false 121 | csharp_space_before_open_square_brackets = false 122 | csharp_space_before_semicolon_in_for_statement = false 123 | csharp_space_between_empty_square_brackets = false 124 | csharp_space_between_method_call_empty_parameter_list_parentheses = false 125 | csharp_space_between_method_call_name_and_opening_parenthesis = false 126 | csharp_space_between_method_call_parameter_list_parentheses = false 127 | csharp_space_between_method_declaration_empty_parameter_list_parentheses = false 128 | csharp_space_between_method_declaration_name_and_open_parenthesis = false 129 | csharp_space_between_method_declaration_parameter_list_parentheses = false 130 | csharp_space_between_parentheses = false 131 | csharp_space_between_square_brackets = false 132 | 133 | [*.{asm,inc}] 134 | indent_size = 8 135 | 136 | # Xml project files 137 | [*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}] 138 | indent_size = 2 139 | 140 | # Xml config files 141 | [*.{props,targets,config,nuspec}] 142 | indent_size = 2 143 | 144 | [CMakeLists.txt] 145 | indent_size = 2 146 | 147 | [*.cmd] 148 | indent_size = 2 -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: CI on Push and Pull Request 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | Android: 7 | runs-on: macos-latest 8 | steps: 9 | - uses: actions/checkout@v1 10 | - name: Android 11 | run: | 12 | nuget restore 13 | msbuild /m XamarinMultiTenant.sln /verbosity:normal /t:Rebuild /p:Configuration=Debug "/p:Platform=Any CPU" 14 | 15 | iOS: 16 | runs-on: macos-latest 17 | steps: 18 | - uses: actions/checkout@v1 19 | - name: iOS 20 | run: | 21 | nuget restore 22 | msbuild /m XamarinMultiTenant.sln /verbosity:normal /t:Rebuild /p:Platform=iPhoneSimulator /p:Configuration=Debug 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Oo]bj/ 31 | [Ll]og/ 32 | 33 | # Visual Studio 2015/2017 cache/options directory 34 | .vs/ 35 | # Uncomment if you have tasks that create the project's static files in wwwroot 36 | #wwwroot/ 37 | 38 | # Visual Studio 2017 auto generated files 39 | Generated\ Files/ 40 | 41 | # MSTest test Results 42 | [Tt]est[Rr]esult*/ 43 | [Bb]uild[Ll]og.* 44 | 45 | # NUNIT 46 | *.VisualState.xml 47 | TestResult.xml 48 | 49 | # Build Results of an ATL Project 50 | [Dd]ebugPS/ 51 | [Rr]eleasePS/ 52 | dlldata.c 53 | 54 | # Benchmark Results 55 | BenchmarkDotNet.Artifacts/ 56 | 57 | # .NET Core 58 | project.lock.json 59 | project.fragment.lock.json 60 | artifacts/ 61 | 62 | # StyleCop 63 | StyleCopReport.xml 64 | 65 | # Files built by Visual Studio 66 | *_i.c 67 | *_p.c 68 | *_h.h 69 | *.ilk 70 | *.meta 71 | *.obj 72 | *.iobj 73 | *.pch 74 | *.pdb 75 | *.ipdb 76 | *.pgc 77 | *.pgd 78 | *.rsp 79 | *.sbr 80 | *.tlb 81 | *.tli 82 | *.tlh 83 | *.tmp 84 | *.tmp_proj 85 | *_wpftmp.csproj 86 | *.log 87 | *.vspscc 88 | *.vssscc 89 | .builds 90 | *.pidb 91 | *.svclog 92 | *.scc 93 | 94 | # Chutzpah Test files 95 | _Chutzpah* 96 | 97 | # Visual C++ cache files 98 | ipch/ 99 | *.aps 100 | *.ncb 101 | *.opendb 102 | *.opensdf 103 | *.sdf 104 | *.cachefile 105 | *.VC.db 106 | *.VC.VC.opendb 107 | 108 | # Visual Studio profiler 109 | *.psess 110 | *.vsp 111 | *.vspx 112 | *.sap 113 | 114 | # Visual Studio Trace Files 115 | *.e2e 116 | 117 | # TFS 2012 Local Workspace 118 | $tf/ 119 | 120 | # Guidance Automation Toolkit 121 | *.gpState 122 | 123 | # ReSharper is a .NET coding add-in 124 | _ReSharper*/ 125 | *.[Rr]e[Ss]harper 126 | *.DotSettings.user 127 | 128 | # JustCode is a .NET coding add-in 129 | .JustCode 130 | 131 | # TeamCity is a build add-in 132 | _TeamCity* 133 | 134 | # DotCover is a Code Coverage Tool 135 | *.dotCover 136 | 137 | # AxoCover is a Code Coverage Tool 138 | .axoCover/* 139 | !.axoCover/settings.json 140 | 141 | # Visual Studio code coverage results 142 | *.coverage 143 | *.coveragexml 144 | 145 | # NCrunch 146 | _NCrunch_* 147 | .*crunch*.local.xml 148 | nCrunchTemp_* 149 | 150 | # MightyMoose 151 | *.mm.* 152 | AutoTest.Net/ 153 | 154 | # Web workbench (sass) 155 | .sass-cache/ 156 | 157 | # Installshield output folder 158 | [Ee]xpress/ 159 | 160 | # DocProject is a documentation generator add-in 161 | DocProject/buildhelp/ 162 | DocProject/Help/*.HxT 163 | DocProject/Help/*.HxC 164 | DocProject/Help/*.hhc 165 | DocProject/Help/*.hhk 166 | DocProject/Help/*.hhp 167 | DocProject/Help/Html2 168 | DocProject/Help/html 169 | 170 | # Click-Once directory 171 | publish/ 172 | 173 | # Publish Web Output 174 | *.[Pp]ublish.xml 175 | *.azurePubxml 176 | # Note: Comment the next line if you want to checkin your web deploy settings, 177 | # but database connection strings (with potential passwords) will be unencrypted 178 | *.pubxml 179 | *.publishproj 180 | 181 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 182 | # checkin your Azure Web App publish settings, but sensitive information contained 183 | # in these scripts will be unencrypted 184 | PublishScripts/ 185 | 186 | # NuGet Packages 187 | *.nupkg 188 | # The packages folder can be ignored because of Package Restore 189 | **/[Pp]ackages/* 190 | # except build/, which is used as an MSBuild target. 191 | !**/[Pp]ackages/build/ 192 | # Uncomment if necessary however generally it will be regenerated when needed 193 | #!**/[Pp]ackages/repositories.config 194 | # NuGet v3's project.json files produces more ignorable files 195 | *.nuget.props 196 | *.nuget.targets 197 | 198 | # Microsoft Azure Build Output 199 | csx/ 200 | *.build.csdef 201 | 202 | # Microsoft Azure Emulator 203 | ecf/ 204 | rcf/ 205 | 206 | # Windows Store app package directories and files 207 | AppPackages/ 208 | BundleArtifacts/ 209 | Package.StoreAssociation.xml 210 | _pkginfo.txt 211 | *.appx 212 | *.appxbundle 213 | *.appxupload 214 | 215 | # Visual Studio cache files 216 | # files ending in .cache can be ignored 217 | *.[Cc]ache 218 | # but keep track of directories ending in .cache 219 | !?*.[Cc]ache/ 220 | 221 | # Others 222 | ClientBin/ 223 | ~$* 224 | *~ 225 | *.dbmdl 226 | *.dbproj.schemaview 227 | *.jfm 228 | *.pfx 229 | *.publishsettings 230 | orleans.codegen.cs 231 | 232 | # Including strong name files can present a security risk 233 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 234 | #*.snk 235 | 236 | # Since there are multiple workflows, uncomment next line to ignore bower_components 237 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 238 | #bower_components/ 239 | 240 | # RIA/Silverlight projects 241 | Generated_Code/ 242 | 243 | # Backup & report files from converting an old project file 244 | # to a newer Visual Studio version. Backup files are not needed, 245 | # because we have git ;-) 246 | _UpgradeReport_Files/ 247 | Backup*/ 248 | UpgradeLog*.XML 249 | UpgradeLog*.htm 250 | ServiceFabricBackup/ 251 | *.rptproj.bak 252 | 253 | # SQL Server files 254 | *.mdf 255 | *.ldf 256 | *.ndf 257 | 258 | # Business Intelligence projects 259 | *.rdl.data 260 | *.bim.layout 261 | *.bim_*.settings 262 | *.rptproj.rsuser 263 | *- Backup*.rdl 264 | 265 | # Microsoft Fakes 266 | FakesAssemblies/ 267 | 268 | # GhostDoc plugin setting file 269 | *.GhostDoc.xml 270 | 271 | # Node.js Tools for Visual Studio 272 | .ntvs_analysis.dat 273 | node_modules/ 274 | 275 | # Visual Studio 6 build log 276 | *.plg 277 | 278 | # Visual Studio 6 workspace options file 279 | *.opt 280 | 281 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 282 | *.vbw 283 | 284 | # Visual Studio LightSwitch build output 285 | **/*.HTMLClient/GeneratedArtifacts 286 | **/*.DesktopClient/GeneratedArtifacts 287 | **/*.DesktopClient/ModelManifest.xml 288 | **/*.Server/GeneratedArtifacts 289 | **/*.Server/ModelManifest.xml 290 | _Pvt_Extensions 291 | 292 | # Paket dependency manager 293 | .paket/paket.exe 294 | paket-files/ 295 | 296 | # FAKE - F# Make 297 | .fake/ 298 | 299 | # CodeRush personal settings 300 | .cr/personal 301 | 302 | # Python Tools for Visual Studio (PTVS) 303 | __pycache__/ 304 | *.pyc 305 | 306 | # Cake - Uncomment if you are using it 307 | # tools/** 308 | # !tools/packages.config 309 | 310 | # Tabs Studio 311 | *.tss 312 | 313 | # Telerik's JustMock configuration file 314 | *.jmconfig 315 | 316 | # BizTalk build output 317 | *.btp.cs 318 | *.btm.cs 319 | *.odx.cs 320 | *.xsd.cs 321 | 322 | # OpenCover UI analysis results 323 | OpenCover/ 324 | 325 | # Azure Stream Analytics local run output 326 | ASALocalRun/ 327 | 328 | # MSBuild Binary and Structured Log 329 | *.binlog 330 | 331 | # NVidia Nsight GPU debugger configuration file 332 | *.nvuser 333 | 334 | # MFractors (Xamarin productivity tool) working folder 335 | .mfractor/ 336 | 337 | # Local History for Visual Studio 338 | .localhistory/ 339 | 340 | # BeatPulse healthcheck temp database 341 | healthchecksdb 342 | 343 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 344 | MigrationBackup/ 345 | 346 | ## 347 | ## Visual studio for Mac 348 | ## 349 | 350 | 351 | # globs 352 | Makefile.in 353 | *.userprefs 354 | *.usertasks 355 | config.make 356 | config.status 357 | aclocal.m4 358 | install-sh 359 | autom4te.cache/ 360 | *.tar.gz 361 | tarballs/ 362 | test-results/ 363 | 364 | # Mac bundle stuff 365 | *.dmg 366 | *.app 367 | 368 | # content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore 369 | # General 370 | .DS_Store 371 | .AppleDouble 372 | .LSOverride 373 | 374 | # Icon must end with two \r 375 | Icon 376 | 377 | 378 | # Thumbnails 379 | ._* 380 | 381 | # Files that might appear in the root of a volume 382 | .DocumentRevisions-V100 383 | .fseventsd 384 | .Spotlight-V100 385 | .TemporaryItems 386 | .Trashes 387 | .VolumeIcon.icns 388 | .com.apple.timemachine.donotpresent 389 | 390 | # Directories potentially created on remote AFP share 391 | .AppleDB 392 | .AppleDesktop 393 | Network Trash Folder 394 | Temporary Items 395 | .apdisk 396 | 397 | # content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore 398 | # Windows thumbnail cache files 399 | Thumbs.db 400 | ehthumbs.db 401 | ehthumbs_vista.db 402 | 403 | # Dump file 404 | *.stackdump 405 | 406 | # Folder config file 407 | [Dd]esktop.ini 408 | 409 | # Recycle Bin used on file shares 410 | $RECYCLE.BIN/ 411 | 412 | # Windows Installer files 413 | *.cab 414 | *.msi 415 | *.msix 416 | *.msm 417 | *.msp 418 | 419 | # Windows shortcuts 420 | *.lnk 421 | 422 | # JetBrains Rider 423 | .idea/ 424 | *.sln.iml 425 | 426 | ## 427 | ## Visual Studio Code 428 | ## 429 | .vscode/* 430 | !.vscode/settings.json 431 | !.vscode/tasks.json 432 | !.vscode/launch.json 433 | !.vscode/extensions.json 434 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Alexandre Santos Costa 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /ReadMe.md: -------------------------------------------------------------------------------- 1 | # Xamarin Multi Tenant 2 | 3 | In this repository [Oberdan Ferreira](https://github.com/oberdanf) and I are demonstrating how to implement a multi tenant solution also knows as "white label"apps using Xamarin.Forms. 4 | 5 | You can watch the [recording of our talk](https://www.infoq.com/br/presentations/desenvolvendo-aplicacoes-multi-tenant/) (in Portuguese). 6 | 7 | Please feel free to fork this repository, or send us your question throught the issues.] -------------------------------------------------------------------------------- /XamarinMultiTenant.Android.Core/MainActivityBase.cs: -------------------------------------------------------------------------------- 1 | using Android.Content.PM; 2 | using Android.OS; 3 | using Android.Runtime; 4 | using Prism; 5 | using Prism.Ioc; 6 | using XamarinMultiTenant.Common; 7 | 8 | namespace XamarinMultiTenant.Android.Core 9 | { 10 | //[Activity(Label = "XamarinMultiTenant", Icon = "@mipmap/ic_launcher", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] 11 | public abstract class MainActivityBase : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity 12 | { 13 | protected abstract ITenant Tenant { get; } 14 | 15 | protected override void OnCreate(Bundle bundle) 16 | { 17 | ResourceIdManager.UpdateIdValues(); 18 | 19 | TabLayoutResource = Resource.Layout.Tabbar; 20 | ToolbarResource = Resource.Layout.Toolbar; 21 | 22 | base.OnCreate(bundle); 23 | 24 | Xamarin.Essentials.Platform.Init(this, bundle); 25 | 26 | global::Xamarin.Forms.Forms.Init(this, bundle); 27 | global::Xamarin.Forms.FormsMaterial.Init(this, bundle); 28 | LoadApplication(new App(new AndroidInitializer(Tenant))); 29 | } 30 | 31 | public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Permission[] grantResults) 32 | { 33 | Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults); 34 | 35 | base.OnRequestPermissionsResult(requestCode, permissions, grantResults); 36 | } 37 | } 38 | 39 | public class AndroidInitializer : IPlatformInitializer 40 | { 41 | private readonly ITenant tenant; 42 | 43 | public AndroidInitializer(ITenant tenant) : base() 44 | { 45 | this.tenant = tenant; 46 | } 47 | 48 | public void RegisterTypes(IContainerRegistry containerRegistry) 49 | { 50 | containerRegistry.RegisterInstance(tenant); 51 | } 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /XamarinMultiTenant.Android.Core/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("XamarinMultiTenant.Android.Core")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("XamarinMultiTenant.Android.Core")] 12 | [assembly: AssemblyCopyright("Copyright © 2018")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | [assembly: ComVisible(false)] 16 | 17 | // Version information for an assembly consists of the following four values: 18 | // 19 | // Major Version 20 | // Minor Version 21 | // Build Number 22 | // Revision 23 | // 24 | // You can specify all the values or you can default the Build and Revision Numbers 25 | // by using the '*' as shown below: 26 | // [assembly: AssemblyVersion("1.0.*")] 27 | [assembly: AssemblyVersion("1.0.0.0")] 28 | [assembly: AssemblyFileVersion("1.0.0.0")] 29 | -------------------------------------------------------------------------------- /XamarinMultiTenant.Android.Core/Resources/AboutResources.txt: -------------------------------------------------------------------------------- 1 | Images, layout descriptions, binary blobs and string dictionaries can be included 2 | in your application as resource files. Various Android APIs are designed to 3 | operate on the resource IDs instead of dealing with images, strings or binary blobs 4 | directly. 5 | 6 | For example, a sample Android app that contains a user interface layout (main.xml), 7 | an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) 8 | would keep its resources in the "Resources" directory of the application: 9 | 10 | Resources/ 11 | drawable-hdpi/ 12 | icon.png 13 | 14 | drawable-ldpi/ 15 | icon.png 16 | 17 | drawable-mdpi/ 18 | icon.png 19 | 20 | layout/ 21 | main.xml 22 | 23 | values/ 24 | strings.xml 25 | 26 | In order to get the build system to recognize Android resources, set the build action to 27 | "AndroidResource". The native Android APIs do not operate directly with filenames, but 28 | instead operate on resource IDs. When you compile an Android application that uses resources, 29 | the build system will package the resources for distribution and generate a class called 30 | "Resource" that contains the tokens for each one of the resources included. For example, 31 | for the above Resources layout, this is what the Resource class would expose: 32 | 33 | public class Resource { 34 | public class drawable { 35 | public const int icon = 0x123; 36 | } 37 | 38 | public class layout { 39 | public const int main = 0x456; 40 | } 41 | 42 | public class strings { 43 | public const int first_string = 0xabc; 44 | public const int second_string = 0xbcd; 45 | } 46 | } 47 | 48 | You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main 49 | to reference the layout/main.xml file, or Resource.strings.first_string to reference the first 50 | string in the dictionary file values/strings.xml. 51 | -------------------------------------------------------------------------------- /XamarinMultiTenant.Android.Core/Resources/layout/Main.axml: -------------------------------------------------------------------------------- 1 |  2 | 3 |