├── .gitattributes ├── .github └── issue_template.md ├── .gitignore ├── .nuget ├── NuGet.Config ├── NuGet.exe └── NuGet.targets ├── LICENSE.md ├── MvcPluginMasterApp.Common ├── MvcPluginMasterApp.Common.csproj ├── Properties │ └── AssemblyInfo.cs ├── WebToolkit │ ├── EmbeddedResourceRouteHandler.cs │ └── EmbeddedResourceTransform.cs ├── app.config └── packages.config ├── MvcPluginMasterApp.DataLayer ├── App.config ├── Context │ ├── Configuration.cs │ └── MvcPluginMasterAppContext.cs ├── MvcPluginMasterApp.DataLayer.csproj ├── Properties │ └── AssemblyInfo.cs └── packages.config ├── MvcPluginMasterApp.DomainClasses ├── App.config ├── Category.cs ├── MvcPluginMasterApp.DomainClasses.csproj ├── Product.cs ├── Properties │ └── AssemblyInfo.cs └── packages.config ├── MvcPluginMasterApp.IoCConfig ├── MvcPluginMasterApp.IoCConfig.csproj ├── Properties │ └── AssemblyInfo.cs ├── SmObjectFactory.cs ├── app.config └── packages.config ├── MvcPluginMasterApp.PluginsBase ├── IPlugin.cs ├── IUnitOfWork.cs ├── MvcPluginMasterApp.PluginsBase.csproj ├── Properties │ └── AssemblyInfo.cs ├── app.config └── packages.config ├── MvcPluginMasterApp.Services ├── App.config ├── ConfigService.cs ├── Contracts │ ├── ICategoryService.cs │ ├── IConfigService.cs │ └── IProductService.cs ├── EfCategoryService.cs ├── EfProductService.cs ├── MvcPluginMasterApp.Services.csproj ├── Properties │ └── AssemblyInfo.cs └── packages.config ├── MvcPluginMasterApp.sln ├── MvcPluginMasterApp ├── App_Start │ ├── BundleConfig.cs │ ├── EFBootstrapperStart.cs │ ├── FilterConfig.cs │ ├── PluginsStart.cs │ ├── RazorGeneratorMvcStart.cs │ ├── RouteConfig.cs │ └── WebApiConfig.cs ├── Content │ ├── bootstrap-theme.css │ ├── bootstrap-theme.css.map │ ├── bootstrap-theme.min.css │ ├── bootstrap-theme.min.css.map │ ├── bootstrap.css │ ├── bootstrap.css.map │ ├── bootstrap.min.css │ ├── bootstrap.min.css.map │ └── site.css ├── Controllers │ └── HomeController.cs ├── Global.asax ├── Global.asax.cs ├── MvcPluginMasterApp.csproj ├── Properties │ └── AssemblyInfo.cs ├── Scripts │ ├── bootstrap.js │ ├── bootstrap.min.js │ ├── jquery-2.2.0.intellisense.js │ ├── jquery-2.2.0.js │ ├── jquery-2.2.0.min.js │ ├── jquery-2.2.0.min.map │ └── modernizr-2.8.3.js ├── Views │ ├── Home │ │ ├── Index.cshtml │ │ ├── Index.generated.cs │ │ ├── Index_cshtml.Designer.cs │ │ ├── Index_cshtml.fa.Designer.cs │ │ ├── Index_cshtml.fa.resx │ │ └── Index_cshtml.resx │ ├── Shared │ │ ├── Error.cshtml │ │ ├── Error.generated.cs │ │ ├── _Layout.cshtml │ │ ├── _Layout.generated.cs │ │ ├── _PluginsMenu.cshtml │ │ └── _PluginsMenu.generated.cs │ ├── Web.config │ ├── _ViewStart.cshtml │ └── _ViewStart.generated.cs ├── Web.Debug.config ├── Web.Release.config ├── Web.config ├── favicon.ico ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 └── packages.config ├── Plugins ├── ArticlesPlugin │ ├── MvcPluginMasterApp.Plugin2.DomainClasses │ │ ├── App.config │ │ ├── Article.cs │ │ ├── MvcPluginMasterApp.Plugin2.DomainClasses.csproj │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── packages.config │ ├── MvcPluginMasterApp.Plugin2.Services │ │ ├── App.config │ │ ├── ConfigService.cs │ │ ├── Contracts │ │ │ ├── IArticlesService.cs │ │ │ └── IConfigService.cs │ │ ├── EfArticlesService.cs │ │ ├── MvcPluginMasterApp.Plugin2.Services.csproj │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── packages.config │ └── MvcPluginMasterApp.Plugin2 │ │ ├── App_Start │ │ ├── Plugin2.cs │ │ └── RazorGeneratorMvcStart.cs │ │ ├── Areas │ │ └── ArticlesArea │ │ │ ├── ArticlesAreaAreaRegistration.cs │ │ │ ├── Controllers │ │ │ └── HomeController.cs │ │ │ └── Views │ │ │ ├── Home │ │ │ ├── Index.cshtml │ │ │ └── Index.generated.cs │ │ │ ├── Web.config │ │ │ ├── _ViewStart.cshtml │ │ │ └── _ViewStart.generated.cs │ │ ├── Content │ │ └── test2.css │ │ ├── Images │ │ └── clock.png │ │ ├── MvcPluginMasterApp.Plugin2.csproj │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── Scripts │ │ └── test2.js │ │ ├── Web.Debug.config │ │ ├── Web.Release.config │ │ ├── Web.config │ │ └── packages.config ├── CommonEntities │ └── CommonEntities │ │ ├── App.config │ │ ├── CommonEntities.csproj │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── User.cs │ │ └── packages.config └── NewsPlugin │ ├── MvcPluginMasterApp.Plugin1.DomainClasses │ ├── App.config │ ├── MvcPluginMasterApp.Plugin1.DomainClasses.csproj │ ├── News.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── packages.config │ ├── MvcPluginMasterApp.Plugin1.Resources │ ├── Home_Index_cshtml.Designer.cs │ ├── Home_Index_cshtml.fa.Designer.cs │ ├── Home_Index_cshtml.fa.resx │ ├── Home_Index_cshtml.resx │ ├── MvcPluginMasterApp.Plugin1.Resources.csproj │ └── Properties │ │ └── AssemblyInfo.cs │ ├── MvcPluginMasterApp.Plugin1.Services │ ├── App.config │ ├── ConfigService.cs │ ├── Contracts │ │ ├── IConfigService.cs │ │ └── INewsService.cs │ ├── EfNewsService.cs │ ├── MvcPluginMasterApp.Plugin1.Services.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ └── packages.config │ └── MvcPluginMasterApp.Plugin1 │ ├── App_Start │ ├── Plugin1.cs │ └── RazorGeneratorMvcStart.cs │ ├── Areas │ └── NewsArea │ │ ├── Controllers │ │ └── HomeController.cs │ │ ├── NewsAreaAreaRegistration.cs │ │ └── Views │ │ ├── Home │ │ ├── Index.cshtml │ │ ├── Index.generated.cs │ │ ├── ShowResources.cshtml │ │ └── ShowResources.generated.cs │ │ ├── Web.config │ │ ├── _ViewStart.cshtml │ │ └── _ViewStart.generated.cs │ ├── Content │ └── test1.css │ ├── Images │ └── chart.png │ ├── MvcPluginMasterApp.Plugin1.csproj │ ├── MvcPluginMasterApp.Plugin1.csproj.user │ ├── Properties │ └── AssemblyInfo.cs │ ├── Scripts │ └── test1.js │ ├── Web.Debug.config │ ├── Web.Release.config │ ├── Web.config │ └── packages.config └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.github/issue_template.md: -------------------------------------------------------------------------------- 1 | # Summary of the issue 2 | 3 | 4 | 5 | ## Environment 6 | 7 | ``` 8 | The in-use version: 9 | Operating system: 10 | IDE: (e.g. Visual Studio 2015) 11 | ``` 12 | 13 | ## Example code/Steps to reproduce: 14 | 15 | ``` 16 | paste your core code 17 | ``` 18 | 19 | ## Output: 20 | 21 | ``` 22 | Exception message: 23 | Full Stack trace: 24 | ``` 25 | 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.sln.docstates 8 | 9 | # Build results 10 | [Dd]ebug/ 11 | [Dd]ebugPublic/ 12 | [Rr]elease/ 13 | x64/ 14 | build/ 15 | bld/ 16 | [Bb]in/ 17 | [Oo]bj/ 18 | 19 | # Roslyn cache directories 20 | *.ide/ 21 | 22 | # MSTest test Results 23 | [Tt]est[Rr]esult*/ 24 | [Bb]uild[Ll]og.* 25 | 26 | #NUNIT 27 | *.VisualState.xml 28 | TestResult.xml 29 | 30 | # Build Results of an ATL Project 31 | [Dd]ebugPS/ 32 | [Rr]eleasePS/ 33 | dlldata.c 34 | 35 | *_i.c 36 | *_p.c 37 | *_i.h 38 | *.ilk 39 | *.meta 40 | *.obj 41 | *.pch 42 | *.pdb 43 | *.pgc 44 | *.pgd 45 | *.rsp 46 | *.sbr 47 | *.tlb 48 | *.tli 49 | *.tlh 50 | *.tmp 51 | *.tmp_proj 52 | *.log 53 | *.vspscc 54 | *.vssscc 55 | .builds 56 | *.pidb 57 | *.svclog 58 | *.scc 59 | 60 | # Chutzpah Test files 61 | _Chutzpah* 62 | 63 | # Visual C++ cache files 64 | ipch/ 65 | *.aps 66 | *.ncb 67 | *.opensdf 68 | *.sdf 69 | *.cachefile 70 | 71 | # Visual Studio profiler 72 | *.psess 73 | *.vsp 74 | *.vspx 75 | 76 | # TFS 2012 Local Workspace 77 | $tf/ 78 | 79 | # Guidance Automation Toolkit 80 | *.gpState 81 | 82 | # ReSharper is a .NET coding add-in 83 | _ReSharper*/ 84 | *.[Rr]e[Ss]harper 85 | *.DotSettings.user 86 | 87 | # JustCode is a .NET coding addin-in 88 | .JustCode 89 | 90 | # TeamCity is a build add-in 91 | _TeamCity* 92 | 93 | # DotCover is a Code Coverage Tool 94 | *.dotCover 95 | 96 | # NCrunch 97 | _NCrunch_* 98 | .*crunch*.local.xml 99 | 100 | # MightyMoose 101 | *.mm.* 102 | AutoTest.Net/ 103 | 104 | # Web workbench (sass) 105 | .sass-cache/ 106 | 107 | # Installshield output folder 108 | [Ee]xpress/ 109 | 110 | # DocProject is a documentation generator add-in 111 | DocProject/buildhelp/ 112 | DocProject/Help/*.HxT 113 | DocProject/Help/*.HxC 114 | DocProject/Help/*.hhc 115 | DocProject/Help/*.hhk 116 | DocProject/Help/*.hhp 117 | DocProject/Help/Html2 118 | DocProject/Help/html 119 | 120 | # Click-Once directory 121 | publish/ 122 | 123 | # Publish Web Output 124 | *.[Pp]ublish.xml 125 | *.azurePubxml 126 | ## TODO: Comment the next line if you want to checkin your 127 | ## web deploy settings but do note that will include unencrypted 128 | ## passwords 129 | #*.pubxml 130 | 131 | # NuGet Packages Directory 132 | packages/* 133 | ## TODO: If the tool you use requires repositories.config 134 | ## uncomment the next line 135 | #!packages/repositories.config 136 | 137 | # Enable "build/" folder in the NuGet Packages folder since 138 | # NuGet packages use it for MSBuild targets. 139 | # This line needs to be after the ignore of the build folder 140 | # (and the packages folder if the line above has been uncommented) 141 | !packages/build/ 142 | 143 | # Windows Azure Build Output 144 | csx/ 145 | *.build.csdef 146 | 147 | # Windows Store app package directory 148 | AppPackages/ 149 | 150 | # Others 151 | sql/ 152 | *.Cache 153 | ClientBin/ 154 | [Ss]tyle[Cc]op.* 155 | ~$* 156 | *~ 157 | *.dbmdl 158 | *.dbproj.schemaview 159 | *.pfx 160 | *.publishsettings 161 | node_modules/ 162 | 163 | # RIA/Silverlight projects 164 | Generated_Code/ 165 | 166 | # Backup & report files from converting an old project file 167 | # to a newer Visual Studio version. Backup files are not needed, 168 | # because we have git ;-) 169 | _UpgradeReport_Files/ 170 | Backup*/ 171 | UpgradeLog*.XML 172 | UpgradeLog*.htm 173 | 174 | # SQL Server files 175 | *.mdf 176 | *.ldf 177 | 178 | # Business Intelligence projects 179 | *.rdl.data 180 | *.bim.layout 181 | *.bim_*.settings 182 | 183 | # Microsoft Fakes 184 | FakesAssemblies/ 185 | 186 | # LightSwitch generated files 187 | GeneratedArtifacts/ 188 | _Pvt_Extensions/ 189 | ModelManifest.xml 190 | /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1/bin 191 | /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1/obj 192 | /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1.DomainClasses/bin 193 | /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1.DomainClasses/obj 194 | /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1.Services/obj 195 | /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1.Services/bin 196 | *.scgdat 197 | -------------------------------------------------------------------------------- /.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VahidN/MvcPlugin/4b98b552d16b6d8b1374459c9ef40fa2d0625041/.nuget/NuGet.exe -------------------------------------------------------------------------------- /MvcPluginMasterApp.Common/MvcPluginMasterApp.Common.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {19C33DC3-1411-431A-AFCA-D8652C9C9B37} 8 | Library 9 | Properties 10 | MvcPluginMasterApp.Common 11 | MvcPluginMasterApp.Common 12 | v4.5 13 | 512 14 | ..\ 15 | true 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | false 27 | 28 | 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | false 36 | 37 | 38 | 39 | ..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll 40 | True 41 | 42 | 43 | ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll 44 | True 45 | 46 | 47 | ..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll 48 | True 49 | 50 | 51 | 52 | 53 | 54 | ..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll 55 | True 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | ..\packages\WebGrease.1.6.0\lib\WebGrease.dll 64 | True 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 81 | 82 | 83 | 84 | 91 | -------------------------------------------------------------------------------- /MvcPluginMasterApp.Common/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MvcPluginMasterApp.Common")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MvcPluginMasterApp.Common")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("fa147955-6e3b-419f-9d29-395d5a9e63ea")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /MvcPluginMasterApp.Common/WebToolkit/EmbeddedResourceRouteHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | using System.Web; 5 | using System.Web.Routing; 6 | 7 | namespace MvcPluginMasterApp.Common.WebToolkit 8 | { 9 | public class EmbeddedResourceRouteHandler : IRouteHandler 10 | { 11 | private readonly Assembly _assembly; 12 | private readonly string _resourcePath; 13 | private readonly TimeSpan _cacheDuration; 14 | 15 | public EmbeddedResourceRouteHandler(Assembly assembly, string resourcePath, TimeSpan cacheDuration) 16 | { 17 | _assembly = assembly; 18 | _resourcePath = resourcePath; 19 | _cacheDuration = cacheDuration; 20 | } 21 | 22 | IHttpHandler IRouteHandler.GetHttpHandler(RequestContext requestContext) 23 | { 24 | return new EmbeddedResourceHttpHandler(requestContext.RouteData, _assembly, _resourcePath, _cacheDuration); 25 | } 26 | } 27 | 28 | public class EmbeddedResourceHttpHandler : IHttpHandler 29 | { 30 | private readonly RouteData _routeData; 31 | private readonly Assembly _assembly; 32 | private readonly string _resourcePath; 33 | private readonly TimeSpan _cacheDuration; 34 | 35 | public EmbeddedResourceHttpHandler( 36 | RouteData routeData, Assembly assembly, string resourcePath, TimeSpan cacheDuration) 37 | { 38 | _routeData = routeData; 39 | _assembly = assembly; 40 | _resourcePath = resourcePath; 41 | _cacheDuration = cacheDuration; 42 | } 43 | 44 | public bool IsReusable 45 | { 46 | get { return false; } 47 | } 48 | 49 | public void ProcessRequest(HttpContext context) 50 | { 51 | var routeDataValues = _routeData.Values; 52 | var fileName = routeDataValues["file"].ToString(); 53 | var fileExtension = routeDataValues["extension"].ToString(); 54 | 55 | var manifestResourceName = string.Format("{0}.{1}.{2}", _resourcePath, fileName, fileExtension); 56 | var stream = _assembly.GetManifestResourceStream(manifestResourceName); 57 | if (stream == null) 58 | { 59 | throw new KeyNotFoundException(string.Format("Embedded resource key: '{0}' not found in the '{1}' assembly.", manifestResourceName, _assembly.FullName)); 60 | } 61 | 62 | context.Response.Clear(); 63 | context.Response.ContentType = "application/octet-stream"; 64 | cacheIt(context.Response, _cacheDuration); 65 | stream.CopyTo(context.Response.OutputStream); 66 | } 67 | 68 | private static void cacheIt(HttpResponse response, TimeSpan duration) 69 | { 70 | var cache = response.Cache; 71 | 72 | var maxAgeField = cache.GetType().GetField("_maxAge", BindingFlags.Instance | BindingFlags.NonPublic); 73 | if (maxAgeField != null) maxAgeField.SetValue(cache, duration); 74 | 75 | cache.SetCacheability(HttpCacheability.Public); 76 | cache.SetExpires(DateTime.Now.Add(duration)); 77 | cache.SetMaxAge(duration); 78 | cache.AppendCacheExtension("must-revalidate, proxy-revalidate"); 79 | } 80 | } 81 | } -------------------------------------------------------------------------------- /MvcPluginMasterApp.Common/WebToolkit/EmbeddedResourceTransform.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using System.Reflection; 4 | using System.Text; 5 | using System.Web.Optimization; 6 | 7 | namespace MvcPluginMasterApp.Common.WebToolkit 8 | { 9 | public class EmbeddedResourceTransform : IBundleTransform 10 | { 11 | private readonly IList _resourceFiles; 12 | private readonly string _contentType; 13 | private readonly Assembly _assembly; 14 | 15 | public EmbeddedResourceTransform(IList resourceFiles, string contentType, Assembly assembly) 16 | { 17 | _resourceFiles = resourceFiles; 18 | _contentType = contentType; 19 | _assembly = assembly; 20 | } 21 | 22 | public void Process(BundleContext context, BundleResponse response) 23 | { 24 | var result = new StringBuilder(); 25 | 26 | foreach (var resource in _resourceFiles) 27 | { 28 | using (var stream = _assembly.GetManifestResourceStream(resource)) 29 | { 30 | if (stream == null) 31 | { 32 | throw new KeyNotFoundException(string.Format("Embedded resource key: '{0}' not found in the '{1}' assembly.", resource, _assembly.FullName)); 33 | } 34 | 35 | using (var reader = new StreamReader(stream)) 36 | { 37 | result.Append(reader.ReadToEnd()); 38 | } 39 | } 40 | } 41 | 42 | response.ContentType = _contentType; 43 | response.Content = result.ToString(); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /MvcPluginMasterApp.Common/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /MvcPluginMasterApp.Common/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MvcPluginMasterApp.DataLayer/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /MvcPluginMasterApp.DataLayer/Context/Configuration.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Entity.Migrations; 2 | using System.Linq; 3 | using MvcPluginMasterApp.DomainClasses; 4 | 5 | namespace MvcPluginMasterApp.DataLayer.Context 6 | { 7 | public class Configuration : DbMigrationsConfiguration 8 | { 9 | public Configuration() 10 | { 11 | AutomaticMigrationsEnabled = true; 12 | AutomaticMigrationDataLossAllowed = true; 13 | } 14 | 15 | protected override void Seed(MvcPluginMasterAppContext context) 16 | { 17 | if (context.Categories.Any()) 18 | { 19 | return; 20 | } 21 | 22 | var cat1 = context.Categories.Add(new Category 23 | { 24 | Name = "Cat 1", 25 | Title = "T1" 26 | }); 27 | var cat2 = context.Categories.Add(new Category 28 | { 29 | Name = "Cat 2", 30 | Title = "T2" 31 | }); 32 | 33 | context.Products.Add(new Product 34 | { 35 | Category = cat1, 36 | Name = "P1", 37 | Price = 1000 38 | }); 39 | 40 | context.Products.Add(new Product 41 | { 42 | Category = cat2, 43 | Name = "P2", 44 | Price = 2000 45 | }); 46 | 47 | 48 | base.Seed(context); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /MvcPluginMasterApp.DataLayer/Context/MvcPluginMasterAppContext.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Data.Entity; 3 | using System.Linq; 4 | using MvcPluginMasterApp.DomainClasses; 5 | using MvcPluginMasterApp.PluginsBase; 6 | using System; 7 | using System.Reflection; 8 | 9 | namespace MvcPluginMasterApp.DataLayer.Context 10 | { 11 | public class MvcPluginMasterAppContext : DbContext, IUnitOfWork 12 | { 13 | private readonly IList _configurationsAssemblies = new List(); 14 | private readonly IList _dynamicTypes = new List(); 15 | 16 | /// 17 | /// It looks for a connection string named Sample07Context in the web.config file. 18 | /// 19 | public MvcPluginMasterAppContext() 20 | : base("connectionString1") 21 | { 22 | } 23 | 24 | public DbSet Categories { set; get; } 25 | public DbSet Products { set; get; } 26 | 27 | public IEnumerable AddThisRange(IEnumerable entities) where TEntity : class 28 | { 29 | return ((DbSet)this.Set()).AddRange(entities); 30 | } 31 | 32 | public void ForceDatabaseInitialize() 33 | { 34 | Database.Initialize(force: true); 35 | } 36 | 37 | public IList GetRows(string sql, params object[] parameters) where T : class 38 | { 39 | return Database.SqlQuery(sql, parameters).ToList(); 40 | } 41 | 42 | public void MarkAsChanged(TEntity entity) where TEntity : class 43 | { 44 | Entry(entity).State = EntityState.Modified; 45 | } 46 | 47 | public int SaveAllChanges() 48 | { 49 | return base.SaveChanges(); 50 | } 51 | 52 | public new IDbSet Set() where TEntity : class 53 | { 54 | return base.Set(); 55 | } 56 | 57 | public void SetConfigurationsAssemblies(Assembly[] assemblies) 58 | { 59 | if (assemblies == null) return; 60 | 61 | foreach (var assembly in assemblies) 62 | { 63 | if (_configurationsAssemblies.Contains(assembly)) continue; 64 | _configurationsAssemblies.Add(assembly); 65 | } 66 | } 67 | 68 | public void SetDynamicEntities(Type[] dynamicTypes) 69 | { 70 | if (dynamicTypes == null) return; 71 | _dynamicTypes.Add(dynamicTypes); 72 | } 73 | 74 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 75 | { 76 | addConfigurationsFromAssemblies(modelBuilder); 77 | addPluginsEntitiesDynamically(modelBuilder); 78 | base.OnModelCreating(modelBuilder); 79 | } 80 | 81 | private void addConfigurationsFromAssemblies(DbModelBuilder modelBuilder) 82 | { 83 | foreach (var assembly in _configurationsAssemblies) 84 | { 85 | modelBuilder.Configurations.AddFromAssembly(assembly); 86 | } 87 | } 88 | 89 | private void addPluginsEntitiesDynamically(DbModelBuilder modelBuilder) 90 | { 91 | foreach (var types in _dynamicTypes) 92 | { 93 | foreach (var type in types) 94 | { 95 | modelBuilder.RegisterEntityType(type); 96 | } 97 | } 98 | } 99 | } 100 | } -------------------------------------------------------------------------------- /MvcPluginMasterApp.DataLayer/MvcPluginMasterApp.DataLayer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {A7FF7546-3295-4557-9FDA-9D0628A63E09} 8 | Library 9 | Properties 10 | MvcPluginMasterApp.DataLayer 11 | MvcPluginMasterApp.DataLayer 12 | v4.5 13 | 512 14 | ..\ 15 | true 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | false 27 | 28 | 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | false 36 | 37 | 38 | 39 | ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll 40 | True 41 | 42 | 43 | ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll 44 | True 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | {855860c4-ee95-4242-b6ae-3a04e26629a2} 67 | MvcPluginMasterApp.DomainClasses 68 | 69 | 70 | {9c48d0fd-2c49-4475-8b92-53d5e0251305} 71 | MvcPluginMasterApp.PluginsBase 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 82 | 83 | 84 | 85 | 92 | -------------------------------------------------------------------------------- /MvcPluginMasterApp.DataLayer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MvcPluginMasterApp.DataLayer")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MvcPluginMasterApp.DataLayer")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("0680a647-35c8-415d-ba1b-0f518310c40e")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /MvcPluginMasterApp.DataLayer/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /MvcPluginMasterApp.DomainClasses/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /MvcPluginMasterApp.DomainClasses/Category.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace MvcPluginMasterApp.DomainClasses 6 | { 7 | public class Category 8 | { 9 | public int Id { get; set; } 10 | 11 | [Required] 12 | [Index(IsUnique = true)] 13 | [StringLength(400)] 14 | public string Name { get; set; } 15 | 16 | [Required] 17 | public string Title { get; set; } 18 | 19 | public virtual ICollection Products { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /MvcPluginMasterApp.DomainClasses/MvcPluginMasterApp.DomainClasses.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {855860C4-EE95-4242-B6AE-3A04E26629A2} 8 | Library 9 | Properties 10 | MvcPluginMasterApp.DomainClasses 11 | MvcPluginMasterApp.DomainClasses 12 | v4.5 13 | 512 14 | ..\ 15 | true 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | false 27 | 28 | 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | false 36 | 37 | 38 | 39 | ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll 40 | True 41 | 42 | 43 | ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll 44 | True 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 69 | 70 | 71 | 72 | 79 | -------------------------------------------------------------------------------- /MvcPluginMasterApp.DomainClasses/Product.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace MvcPluginMasterApp.DomainClasses 5 | { 6 | public class Product 7 | { 8 | public int Id { get; set; } 9 | 10 | [Required] 11 | [Index(IsUnique = true)] 12 | [StringLength(400)] 13 | public string Name { get; set; } 14 | 15 | [Required] 16 | public decimal Price { get; set; } 17 | 18 | [ForeignKey("CategoryId")] 19 | public virtual Category Category { get; set; } 20 | public int CategoryId { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /MvcPluginMasterApp.DomainClasses/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MvcPluginMasterApp.DomainClasses")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MvcPluginMasterApp.DomainClasses")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("a512287f-c420-49d1-8b19-993bab62d6cf")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /MvcPluginMasterApp.DomainClasses/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /MvcPluginMasterApp.IoCConfig/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MvcPluginMasterApp.IoCConfig")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MvcPluginMasterApp.IoCConfig")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("47dda20d-6b66-4060-a447-bd21fb7d3450")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /MvcPluginMasterApp.IoCConfig/SmObjectFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Threading; 4 | using System.Web; 5 | using MvcPluginMasterApp.DataLayer.Context; 6 | using MvcPluginMasterApp.PluginsBase; 7 | using MvcPluginMasterApp.Services; 8 | using MvcPluginMasterApp.Services.Contracts; 9 | using StructureMap; 10 | using StructureMap.Graph; 11 | using StructureMap.Web; 12 | 13 | namespace MvcPluginMasterApp.IoCConfig 14 | { 15 | public static class SmObjectFactory 16 | { 17 | private static readonly Lazy _containerBuilder = 18 | new Lazy(defaultContainer, LazyThreadSafetyMode.ExecutionAndPublication); 19 | 20 | public static IContainer Container 21 | { 22 | get { return _containerBuilder.Value; } 23 | } 24 | 25 | private static Container defaultContainer() 26 | { 27 | return new Container(cfg => 28 | { 29 | //x.For().Use(); == scanner.WithDefaultConventions(); 30 | 31 | cfg.For() 32 | .HybridHttpOrThreadLocalScoped() 33 | .Use(); 34 | 35 | cfg.For().Use(); 36 | cfg.For().Use(); 37 | 38 | cfg.Scan(scanner => 39 | { 40 | scanner.AssembliesFromPath( 41 | path: Path.Combine(HttpRuntime.AppDomainAppPath, "bin"), 42 | // يك اسمبلي نبايد دوبار بارگذاري شود 43 | assemblyFilter: assembly => 44 | { 45 | return !assembly.FullName.Equals(typeof(IPlugin).Assembly.FullName); 46 | }); 47 | 48 | scanner.WithDefaultConventions(); //Connects 'IName' interface to 'Name' class automatically. 49 | scanner.AddAllTypesOf().NameBy(item => item.FullName); 50 | }); 51 | }); 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /MvcPluginMasterApp.IoCConfig/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /MvcPluginMasterApp.IoCConfig/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /MvcPluginMasterApp.PluginsBase/IPlugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Web.Optimization; 4 | using System.Web.Routing; 5 | using StructureMap; 6 | 7 | namespace MvcPluginMasterApp.PluginsBase 8 | { 9 | public interface IPlugin 10 | { 11 | EfBootstrapper GetEfBootstrapper(); 12 | MenuItem GetMenuItem(RequestContext requestContext); 13 | void RegisterBundles(BundleCollection bundles); 14 | void RegisterRoutes(RouteCollection routes); 15 | void RegisterServices(IContainer container); 16 | } 17 | 18 | public class EfBootstrapper 19 | { 20 | /// 21 | /// Assemblies containing EntityTypeConfiguration classes. 22 | /// 23 | public Assembly[] ConfigurationsAssemblies { get; set; } 24 | 25 | /// 26 | /// Domain classes. 27 | /// 28 | public Type[] DomainEntities { get; set; } 29 | 30 | /// 31 | /// Custom Seed method. 32 | /// 33 | public Action DatabaseSeeder { get; set; } 34 | } 35 | 36 | public class MenuItem 37 | { 38 | public string Name { set; get; } 39 | public string Url { set; get; } 40 | } 41 | } -------------------------------------------------------------------------------- /MvcPluginMasterApp.PluginsBase/IUnitOfWork.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data.Entity; 4 | using System.Reflection; 5 | 6 | namespace MvcPluginMasterApp.PluginsBase 7 | { 8 | public interface IUnitOfWork : IDisposable 9 | { 10 | IDbSet Set() where TEntity : class; 11 | int SaveAllChanges(); 12 | void MarkAsChanged(TEntity entity) where TEntity : class; 13 | IList GetRows(string sql, params object[] parameters) where T : class; 14 | IEnumerable AddThisRange(IEnumerable entities) where TEntity : class; 15 | void SetDynamicEntities(Type[] dynamicTypes); 16 | void ForceDatabaseInitialize(); 17 | void SetConfigurationsAssemblies(Assembly[] assembly); 18 | } 19 | } -------------------------------------------------------------------------------- /MvcPluginMasterApp.PluginsBase/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MvcPluginMasterApp.PluginsBase")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MvcPluginMasterApp.PluginsBase")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("9ff6d0d2-765e-4c9d-b153-a9cdd3a5d00f")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /MvcPluginMasterApp.PluginsBase/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /MvcPluginMasterApp.PluginsBase/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /MvcPluginMasterApp.Services/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /MvcPluginMasterApp.Services/ConfigService.cs: -------------------------------------------------------------------------------- 1 | using MvcPluginMasterApp.Services.Contracts; 2 | 3 | namespace MvcPluginMasterApp.Services 4 | { 5 | public class ConfigService : IConfigService 6 | { 7 | public string MasterKey 8 | { 9 | get { return "Master Key 1"; } 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /MvcPluginMasterApp.Services/Contracts/ICategoryService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using MvcPluginMasterApp.DomainClasses; 3 | 4 | namespace MvcPluginMasterApp.Services.Contracts 5 | { 6 | public interface ICategoryService 7 | { 8 | void AddNewCategory(Category category); 9 | IList GetAllCategories(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /MvcPluginMasterApp.Services/Contracts/IConfigService.cs: -------------------------------------------------------------------------------- 1 | namespace MvcPluginMasterApp.Services.Contracts 2 | { 3 | public interface IConfigService 4 | { 5 | string MasterKey { get; } 6 | } 7 | } -------------------------------------------------------------------------------- /MvcPluginMasterApp.Services/Contracts/IProductService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using MvcPluginMasterApp.DomainClasses; 3 | 4 | namespace MvcPluginMasterApp.Services.Contracts 5 | { 6 | public interface IProductService 7 | { 8 | void AddNewProduct(Product product); 9 | IList GetAllProducts(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /MvcPluginMasterApp.Services/EfCategoryService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Data.Entity; 3 | using System.Linq; 4 | using MvcPluginMasterApp.DomainClasses; 5 | using MvcPluginMasterApp.PluginsBase; 6 | using MvcPluginMasterApp.Services.Contracts; 7 | 8 | namespace MvcPluginMasterApp.Services 9 | { 10 | public class EfCategoryService : ICategoryService 11 | { 12 | IUnitOfWork _uow; 13 | readonly IDbSet _categories; 14 | public EfCategoryService(IUnitOfWork uow) 15 | { 16 | _uow = uow; 17 | _categories = _uow.Set(); 18 | } 19 | 20 | public void AddNewCategory(Category category) 21 | { 22 | _categories.Add(category); 23 | } 24 | 25 | public IList GetAllCategories() 26 | { 27 | return _categories.ToList(); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /MvcPluginMasterApp.Services/EfProductService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Data.Entity; 3 | using System.Linq; 4 | using MvcPluginMasterApp.DomainClasses; 5 | using MvcPluginMasterApp.PluginsBase; 6 | using MvcPluginMasterApp.Services.Contracts; 7 | 8 | namespace MvcPluginMasterApp.Services 9 | { 10 | public class EfProductService : IProductService 11 | { 12 | IUnitOfWork _uow; 13 | readonly IDbSet _products; 14 | public EfProductService(IUnitOfWork uow) 15 | { 16 | _uow = uow; 17 | _products = _uow.Set(); 18 | } 19 | 20 | public void AddNewProduct(Product product) 21 | { 22 | _products.Add(product); 23 | } 24 | 25 | public IList GetAllProducts() 26 | { 27 | return _products.Include(x => x.Category).ToList(); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /MvcPluginMasterApp.Services/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MvcPluginMasterApp.Services")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MvcPluginMasterApp.Services")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("7dccaf41-5b25-46f3-9dbd-260e5bb5104b")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /MvcPluginMasterApp.Services/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /MvcPluginMasterApp/App_Start/BundleConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Optimization; 2 | 3 | namespace MvcPluginMasterApp 4 | { 5 | public class BundleConfig 6 | { 7 | // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862 8 | public static void RegisterBundles(BundleCollection bundles) 9 | { 10 | bundles.Add(new ScriptBundle("~/bundles/jquery").Include( 11 | "~/Scripts/jquery-{version}.js")); 12 | 13 | // Use the development version of Modernizr to develop with and learn from. Then, when you're 14 | // ready for production, use the build tool at http://modernizr.com to pick only the tests you need. 15 | bundles.Add(new ScriptBundle("~/bundles/modernizr").Include( 16 | "~/Scripts/modernizr-*")); 17 | 18 | bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include( 19 | "~/Scripts/bootstrap.js", 20 | "~/Scripts/respond.js")); 21 | 22 | bundles.Add(new StyleBundle("~/Content/css").Include( 23 | "~/Content/bootstrap.css", 24 | "~/Content/site.css")); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /MvcPluginMasterApp/App_Start/EFBootstrapperStart.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Data.Entity; 3 | using System.Linq; 4 | using MvcPluginMasterApp; 5 | using MvcPluginMasterApp.DataLayer.Context; 6 | using MvcPluginMasterApp.IoCConfig; 7 | using MvcPluginMasterApp.PluginsBase; 8 | using WebActivatorEx; 9 | 10 | [assembly: PreApplicationStartMethod(typeof(EFBootstrapperStart), "Start")] 11 | namespace MvcPluginMasterApp 12 | { 13 | public static class EFBootstrapperStart 14 | { 15 | public static void Start() 16 | { 17 | var plugins = SmObjectFactory.Container.GetAllInstances().ToList(); 18 | using (var uow = SmObjectFactory.Container.GetInstance()) 19 | { 20 | initDatabase(uow, plugins); 21 | runDatabaseSeeders(uow, plugins); 22 | } 23 | } 24 | 25 | private static void initDatabase(IUnitOfWork uow, IEnumerable plugins) 26 | { 27 | foreach (var plugin in plugins) 28 | { 29 | var efBootstrapper = plugin.GetEfBootstrapper(); 30 | if (efBootstrapper == null) continue; 31 | 32 | uow.SetDynamicEntities(efBootstrapper.DomainEntities); 33 | uow.SetConfigurationsAssemblies(efBootstrapper.ConfigurationsAssemblies); 34 | } 35 | 36 | Database.SetInitializer(new MigrateDatabaseToLatestVersion()); 37 | uow.ForceDatabaseInitialize(); 38 | } 39 | 40 | private static void runDatabaseSeeders(IUnitOfWork uow, IEnumerable plugins) 41 | { 42 | foreach (var plugin in plugins) 43 | { 44 | var efBootstrapper = plugin.GetEfBootstrapper(); 45 | if (efBootstrapper == null || efBootstrapper.DatabaseSeeder == null) continue; 46 | 47 | efBootstrapper.DatabaseSeeder(uow); 48 | uow.SaveAllChanges(); 49 | } 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /MvcPluginMasterApp/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | 4 | namespace MvcPluginMasterApp 5 | { 6 | public class FilterConfig 7 | { 8 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 9 | { 10 | filters.Add(new HandleErrorAttribute()); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /MvcPluginMasterApp/App_Start/PluginsStart.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Web.Optimization; 3 | using System.Web.Routing; 4 | using MvcPluginMasterApp; 5 | using MvcPluginMasterApp.IoCConfig; 6 | using MvcPluginMasterApp.PluginsBase; 7 | 8 | [assembly: WebActivatorEx.PostApplicationStartMethod(typeof(PluginsStart), "Start")] 9 | 10 | namespace MvcPluginMasterApp 11 | { 12 | public static class PluginsStart 13 | { 14 | public static void Start() 15 | { 16 | var plugins = SmObjectFactory.Container.GetAllInstances().ToList(); 17 | foreach (var plugin in plugins) 18 | { 19 | plugin.RegisterServices(SmObjectFactory.Container); 20 | plugin.RegisterRoutes(RouteTable.Routes); 21 | plugin.RegisterBundles(BundleTable.Bundles); 22 | } 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /MvcPluginMasterApp/App_Start/RazorGeneratorMvcStart.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | using System.Web.WebPages; 4 | using MvcPluginMasterApp; 5 | using RazorGenerator.Mvc; 6 | 7 | [assembly: WebActivatorEx.PostApplicationStartMethod(typeof(RazorGeneratorMvcStart), "Start")] 8 | 9 | namespace MvcPluginMasterApp { 10 | public static class RazorGeneratorMvcStart { 11 | public static void Start() { 12 | var engine = new PrecompiledMvcEngine(typeof(RazorGeneratorMvcStart).Assembly) { 13 | UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal 14 | }; 15 | 16 | ViewEngines.Engines.Insert(0, engine); 17 | 18 | // StartPage lookups are done by WebPages. 19 | VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /MvcPluginMasterApp/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace MvcPluginMasterApp 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapRoute( 17 | name: "Default", 18 | url: "{controller}/{action}/{id}", 19 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }, 20 | // مشخص كردن فضاي نام مرتبط جهت جلوگيري از تداخل با ساير قسمت‌هاي برنامه 21 | namespaces: new[] { string.Format("{0}.Controllers", typeof(RouteConfig).Namespace) } 22 | ); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /MvcPluginMasterApp/App_Start/WebApiConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web.Http; 5 | 6 | namespace MvcPluginMasterApp 7 | { 8 | public static class WebApiConfig 9 | { 10 | public static void Register(HttpConfiguration config) 11 | { 12 | config.Routes.MapHttpRoute( 13 | name: "DefaultApi", 14 | routeTemplate: "api/{controller}/{id}", 15 | defaults: new { id = RouteParameter.Optional } 16 | ); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /MvcPluginMasterApp/Content/site.css: -------------------------------------------------------------------------------- 1 | body { padding-top: 70px; } 2 | -------------------------------------------------------------------------------- /MvcPluginMasterApp/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using MvcPluginMasterApp.Services.Contracts; 2 | using System.Web.Mvc; 3 | 4 | namespace MvcPluginMasterApp.Controllers 5 | { 6 | public class HomeController : Controller 7 | { 8 | private readonly IConfigService _configService; 9 | 10 | public HomeController(IConfigService configService) 11 | { 12 | _configService = configService; 13 | } 14 | 15 | public ActionResult Index() 16 | { 17 | ViewBag.Message = string.Format("From MvcPluginMasterApp: {0}", _configService.MasterKey); 18 | return View(); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /MvcPluginMasterApp/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="MvcPluginMasterApp.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /MvcPluginMasterApp/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web; 3 | using System.Web.Http; 4 | using System.Web.Mvc; 5 | using System.Web.Optimization; 6 | using System.Web.Routing; 7 | using MvcPluginMasterApp.IoCConfig; 8 | using StructureMap.Web.Pipeline; 9 | 10 | namespace MvcPluginMasterApp 11 | { 12 | public class MvcApplication : HttpApplication 13 | { 14 | protected void Application_Start() 15 | { 16 | AreaRegistration.RegisterAllAreas(); 17 | 18 | WebApiConfig.Register(GlobalConfiguration.Configuration); 19 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 20 | RouteConfig.RegisterRoutes(RouteTable.Routes); 21 | BundleConfig.RegisterBundles(BundleTable.Bundles); 22 | 23 | initStructureMap(); 24 | } 25 | 26 | protected void Application_EndRequest(object sender, EventArgs e) 27 | { 28 | HttpContextLifecycle.DisposeAndClearAll(); 29 | } 30 | 31 | private static void initStructureMap() 32 | { 33 | //Set current Controller factory as StructureMapControllerFactory 34 | ControllerBuilder.Current.SetControllerFactory(new StructureMapControllerFactory()); 35 | } 36 | } 37 | 38 | public class StructureMapControllerFactory : DefaultControllerFactory 39 | { 40 | protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType) 41 | { 42 | if (controllerType == null) 43 | throw new InvalidOperationException(string.Format("Page not found: {0}", requestContext.HttpContext.Request.RawUrl)); 44 | return SmObjectFactory.Container.GetInstance(controllerType) as Controller; 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /MvcPluginMasterApp/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MvcPluginMasterApp")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MvcPluginMasterApp")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("0de309dd-8b5b-42e1-829a-fcb2edc6ee47")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /MvcPluginMasterApp/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Home Page"; 3 | } 4 | 5 |
6 |

@ViewBag.Message

7 | From resource file: @MvcPluginMasterApp.Views.Home.Index_cshtml.Name 8 |
-------------------------------------------------------------------------------- /MvcPluginMasterApp/Views/Home/Index.generated.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable 1591 2 | //------------------------------------------------------------------------------ 3 | // 4 | // This code was generated by a tool. 5 | // Runtime Version:4.0.30319.42000 6 | // 7 | // Changes to this file may cause incorrect behavior and will be lost if 8 | // the code is regenerated. 9 | // 10 | //------------------------------------------------------------------------------ 11 | 12 | namespace ASP 13 | { 14 | using System; 15 | using System.Collections.Generic; 16 | using System.IO; 17 | using System.Linq; 18 | using System.Net; 19 | using System.Text; 20 | using System.Web; 21 | using System.Web.Helpers; 22 | using System.Web.Mvc; 23 | using System.Web.Mvc.Ajax; 24 | using System.Web.Mvc.Html; 25 | using System.Web.Optimization; 26 | using System.Web.Routing; 27 | using System.Web.Security; 28 | using System.Web.UI; 29 | using System.Web.WebPages; 30 | 31 | [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")] 32 | [System.Web.WebPages.PageVirtualPathAttribute("~/Views/Home/Index.cshtml")] 33 | public partial class _Views_Home_Index_cshtml : System.Web.Mvc.WebViewPage 34 | { 35 | public _Views_Home_Index_cshtml() 36 | { 37 | } 38 | public override void Execute() 39 | { 40 | 41 | #line 1 "..\..\Views\Home\Index.cshtml" 42 | 43 | ViewBag.Title = "Home Page"; 44 | 45 | 46 | #line default 47 | #line hidden 48 | WriteLiteral("\r\n\r\n\r\n

"); 53 | 54 | 55 | #line 6 "..\..\Views\Home\Index.cshtml" 56 | Write(ViewBag.Message); 57 | 58 | 59 | #line default 60 | #line hidden 61 | WriteLiteral("

\r\n From resource file: "); 62 | 63 | 64 | #line 7 "..\..\Views\Home\Index.cshtml" 65 | Write(MvcPluginMasterApp.Views.Home.Index_cshtml.Name); 66 | 67 | 68 | #line default 69 | #line hidden 70 | WriteLiteral("\r\n"); 71 | 72 | } 73 | } 74 | } 75 | #pragma warning restore 1591 76 | -------------------------------------------------------------------------------- /MvcPluginMasterApp/Views/Home/Index_cshtml.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace MvcPluginMasterApp.Views.Home { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | public class Index_cshtml { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Index_cshtml() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | public static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MvcPluginMasterApp.Views.Home.Index_cshtml", typeof(Index_cshtml).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | public static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized string similar to Employee Name. 65 | /// 66 | public static string Name { 67 | get { 68 | return ResourceManager.GetString("Name", resourceCulture); 69 | } 70 | } 71 | 72 | /// 73 | /// Looks up a localized string similar to Name is required. 74 | /// 75 | public static string NameIsNotRight { 76 | get { 77 | return ResourceManager.GetString("NameIsNotRight", resourceCulture); 78 | } 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /MvcPluginMasterApp/Views/Home/Index_cshtml.fa.Designer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VahidN/MvcPlugin/4b98b552d16b6d8b1374459c9ef40fa2d0625041/MvcPluginMasterApp/Views/Home/Index_cshtml.fa.Designer.cs -------------------------------------------------------------------------------- /MvcPluginMasterApp/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = null; 3 | } 4 | 5 | 6 | 7 | 8 | 9 | Error 10 | 11 | 12 |
13 |

Error.

14 |

An error occurred while processing your request.

15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /MvcPluginMasterApp/Views/Shared/Error.generated.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable 1591 2 | //------------------------------------------------------------------------------ 3 | // 4 | // This code was generated by a tool. 5 | // Runtime Version:4.0.30319.42000 6 | // 7 | // Changes to this file may cause incorrect behavior and will be lost if 8 | // the code is regenerated. 9 | // 10 | //------------------------------------------------------------------------------ 11 | 12 | namespace ASP 13 | { 14 | using System; 15 | using System.Collections.Generic; 16 | using System.IO; 17 | using System.Linq; 18 | using System.Net; 19 | using System.Text; 20 | using System.Web; 21 | using System.Web.Helpers; 22 | using System.Web.Mvc; 23 | using System.Web.Mvc.Ajax; 24 | using System.Web.Mvc.Html; 25 | using System.Web.Optimization; 26 | using System.Web.Routing; 27 | using System.Web.Security; 28 | using System.Web.UI; 29 | using System.Web.WebPages; 30 | 31 | [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")] 32 | [System.Web.WebPages.PageVirtualPathAttribute("~/Views/Shared/Error.cshtml")] 33 | public partial class _Views_Shared_Error_cshtml : System.Web.Mvc.WebViewPage 34 | { 35 | public _Views_Shared_Error_cshtml() 36 | { 37 | } 38 | public override void Execute() 39 | { 40 | 41 | #line 1 "..\..\Views\Shared\Error.cshtml" 42 | 43 | Layout = null; 44 | 45 | 46 | #line default 47 | #line hidden 48 | WriteLiteral("\r\n\r\n\r\n\r\n\r\n \r\n Error\r\n\r\n\r\n
\r\n

Error.<" + 55 | "/h1>\r\n

An error occurred while processing your request.

\r\n \r\n\r\n\r\n"); 57 | 58 | } 59 | } 60 | } 61 | #pragma warning restore 1591 62 | -------------------------------------------------------------------------------- /MvcPluginMasterApp/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | @ViewBag.Title - My ASP.NET Application 7 | @Styles.Render("~/Content/css") 8 | @Scripts.Render("~/bundles/modernizr") 9 | 10 | 11 | 29 |
30 |
31 | @RenderBody() 32 |
33 |
34 |
35 |

© @DateTime.Now.Year - DNT

36 |
37 |
38 | 39 | @Scripts.Render("~/bundles/jquery") 40 | @Scripts.Render("~/bundles/bootstrap") 41 | @RenderSection("scripts", required: false) 42 | 43 | -------------------------------------------------------------------------------- /MvcPluginMasterApp/Views/Shared/_PluginsMenu.cshtml: -------------------------------------------------------------------------------- 1 | @using MvcPluginMasterApp.IoCConfig 2 | @using MvcPluginMasterApp.PluginsBase 3 | @{ 4 | var plugins = SmObjectFactory.Container.GetAllInstances().ToList(); 5 | } 6 | 7 | @foreach (var plugin in plugins) 8 | { 9 | var menuItem = plugin.GetMenuItem(this.Request.RequestContext); 10 |
  • 11 | @menuItem.Name 12 |
  • 13 | } -------------------------------------------------------------------------------- /MvcPluginMasterApp/Views/Shared/_PluginsMenu.generated.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable 1591 2 | //------------------------------------------------------------------------------ 3 | // 4 | // This code was generated by a tool. 5 | // Runtime Version:4.0.30319.42000 6 | // 7 | // Changes to this file may cause incorrect behavior and will be lost if 8 | // the code is regenerated. 9 | // 10 | //------------------------------------------------------------------------------ 11 | 12 | namespace ASP 13 | { 14 | using System; 15 | using System.Collections.Generic; 16 | using System.IO; 17 | using System.Linq; 18 | using System.Net; 19 | using System.Text; 20 | using System.Web; 21 | using System.Web.Helpers; 22 | using System.Web.Mvc; 23 | using System.Web.Mvc.Ajax; 24 | using System.Web.Mvc.Html; 25 | using System.Web.Optimization; 26 | using System.Web.Routing; 27 | using System.Web.Security; 28 | using System.Web.UI; 29 | using System.Web.WebPages; 30 | 31 | #line 1 "..\..\Views\Shared\_PluginsMenu.cshtml" 32 | using MvcPluginMasterApp.IoCConfig; 33 | 34 | #line default 35 | #line hidden 36 | 37 | #line 2 "..\..\Views\Shared\_PluginsMenu.cshtml" 38 | using MvcPluginMasterApp.PluginsBase; 39 | 40 | #line default 41 | #line hidden 42 | 43 | [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")] 44 | [System.Web.WebPages.PageVirtualPathAttribute("~/Views/Shared/_PluginsMenu.cshtml")] 45 | public partial class _Views_Shared__PluginsMenu_cshtml : System.Web.Mvc.WebViewPage 46 | { 47 | public _Views_Shared__PluginsMenu_cshtml() 48 | { 49 | } 50 | public override void Execute() 51 | { 52 | 53 | #line 3 "..\..\Views\Shared\_PluginsMenu.cshtml" 54 | 55 | var plugins = SmObjectFactory.Container.GetAllInstances().ToList(); 56 | 57 | 58 | #line default 59 | #line hidden 60 | WriteLiteral("\r\n\r\n"); 61 | 62 | 63 | #line 7 "..\..\Views\Shared\_PluginsMenu.cshtml" 64 | foreach (var plugin in plugins) 65 | { 66 | var menuItem = plugin.GetMenuItem(this.Request.RequestContext); 67 | 68 | 69 | #line default 70 | #line hidden 71 | WriteLiteral("
  • \r\n (menuItem.Url 77 | 78 | #line default 79 | #line hidden 80 | , 300), false) 81 | ); 82 | 83 | WriteLiteral(">"); 84 | 85 | 86 | #line 11 "..\..\Views\Shared\_PluginsMenu.cshtml" 87 | Write(menuItem.Name); 88 | 89 | 90 | #line default 91 | #line hidden 92 | WriteLiteral("\r\n
  • \r\n"); 93 | 94 | 95 | #line 13 "..\..\Views\Shared\_PluginsMenu.cshtml" 96 | } 97 | 98 | #line default 99 | #line hidden 100 | } 101 | } 102 | } 103 | #pragma warning restore 1591 104 | -------------------------------------------------------------------------------- /MvcPluginMasterApp/Views/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 |
    7 |
    8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 40 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /MvcPluginMasterApp/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /MvcPluginMasterApp/Views/_ViewStart.generated.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable 1591 2 | //------------------------------------------------------------------------------ 3 | // 4 | // This code was generated by a tool. 5 | // Runtime Version:4.0.30319.42000 6 | // 7 | // Changes to this file may cause incorrect behavior and will be lost if 8 | // the code is regenerated. 9 | // 10 | //------------------------------------------------------------------------------ 11 | 12 | namespace ASP 13 | { 14 | using System; 15 | using System.Collections.Generic; 16 | using System.IO; 17 | using System.Linq; 18 | using System.Net; 19 | using System.Text; 20 | using System.Web; 21 | using System.Web.Helpers; 22 | using System.Web.Mvc; 23 | using System.Web.Mvc.Ajax; 24 | using System.Web.Mvc.Html; 25 | using System.Web.Optimization; 26 | using System.Web.Routing; 27 | using System.Web.Security; 28 | using System.Web.UI; 29 | using System.Web.WebPages; 30 | 31 | [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")] 32 | [System.Web.WebPages.PageVirtualPathAttribute("~/Views/_ViewStart.cshtml")] 33 | public partial class _Views__ViewStart_cshtml : System.Web.Mvc.ViewStartPage 34 | { 35 | public _Views__ViewStart_cshtml() 36 | { 37 | } 38 | public override void Execute() 39 | { 40 | 41 | #line 1 "..\..\Views\_ViewStart.cshtml" 42 | 43 | Layout = "~/Views/Shared/_Layout.cshtml"; 44 | 45 | 46 | #line default 47 | #line hidden 48 | WriteLiteral("\r\n"); 49 | 50 | } 51 | } 52 | } 53 | #pragma warning restore 1591 54 | -------------------------------------------------------------------------------- /MvcPluginMasterApp/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /MvcPluginMasterApp/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /MvcPluginMasterApp/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VahidN/MvcPlugin/4b98b552d16b6d8b1374459c9ef40fa2d0625041/MvcPluginMasterApp/favicon.ico -------------------------------------------------------------------------------- /MvcPluginMasterApp/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VahidN/MvcPlugin/4b98b552d16b6d8b1374459c9ef40fa2d0625041/MvcPluginMasterApp/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /MvcPluginMasterApp/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VahidN/MvcPlugin/4b98b552d16b6d8b1374459c9ef40fa2d0625041/MvcPluginMasterApp/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /MvcPluginMasterApp/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VahidN/MvcPlugin/4b98b552d16b6d8b1374459c9ef40fa2d0625041/MvcPluginMasterApp/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /MvcPluginMasterApp/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VahidN/MvcPlugin/4b98b552d16b6d8b1374459c9ef40fa2d0625041/MvcPluginMasterApp/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /MvcPluginMasterApp/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2.DomainClasses/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
    6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2.DomainClasses/Article.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations.Schema; 2 | using System.Data.Entity.ModelConfiguration; 3 | using CommonEntities; 4 | 5 | namespace MvcPluginMasterApp.Plugin2.DomainClasses 6 | { 7 | public class Article 8 | { 9 | public int Id { set; get; } 10 | 11 | public string Title { set; get; } 12 | 13 | public string Body { set; get; } 14 | 15 | 16 | [ForeignKey("UserId")] 17 | public virtual User User { set; get; } 18 | public int UserId { set; get; } 19 | } 20 | 21 | public class ArticlesConfig : EntityTypeConfiguration
    22 | { 23 | public ArticlesConfig() 24 | { 25 | this.ToTable("Plugin2_Articles"); 26 | this.HasKey(article => article.Id); 27 | this.Property(article => article.Title).IsRequired().HasMaxLength(500); 28 | this.Property(article => article.Body).IsOptional().IsMaxLength(); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2.DomainClasses/MvcPluginMasterApp.Plugin2.DomainClasses.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {0D65EC8D-1950-40AC-A154-E2CD4CBC6141} 8 | Library 9 | Properties 10 | MvcPluginMasterApp.Plugin2.DomainClasses 11 | MvcPluginMasterApp.Plugin2.DomainClasses 12 | v4.5 13 | 512 14 | ..\..\..\ 15 | true 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | false 27 | 28 | 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | false 36 | 37 | 38 | 39 | ..\..\..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll 40 | True 41 | 42 | 43 | ..\..\..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll 44 | True 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | {193814d6-ebed-4f59-b716-79515e373dc1} 66 | CommonEntities 67 | 68 | 69 | 70 | 71 | 72 | 73 | This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 74 | 75 | 76 | 77 | 84 | -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2.DomainClasses/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MvcPluginMasterApp.Plugin2.DomainClasses")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MvcPluginMasterApp.Plugin2.DomainClasses")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("7ac0d576-e9f2-4576-8315-5c1c8daeac55")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2.DomainClasses/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2.Services/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
    6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2.Services/ConfigService.cs: -------------------------------------------------------------------------------- 1 | using MvcPluginMasterApp.Plugin2.Services.Contracts; 2 | 3 | namespace MvcPluginMasterApp.Plugin2.Services 4 | { 5 | public class ConfigService : IConfigService 6 | { 7 | public string Key2 8 | { 9 | get { return "Value 2"; } 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2.Services/Contracts/IArticlesService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using MvcPluginMasterApp.Plugin2.DomainClasses; 3 | 4 | namespace MvcPluginMasterApp.Plugin2.Services.Contracts 5 | { 6 | public interface IArticlesService 7 | { 8 | void AddArticle(Article news); 9 | IList
    GetAllArticles(); 10 | } 11 | } -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2.Services/Contracts/IConfigService.cs: -------------------------------------------------------------------------------- 1 | namespace MvcPluginMasterApp.Plugin2.Services.Contracts 2 | { 3 | public interface IConfigService 4 | { 5 | string Key2 { get; } 6 | } 7 | } -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2.Services/EfArticlesService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Data.Entity; 3 | using System.Linq; 4 | using MvcPluginMasterApp.Plugin2.DomainClasses; 5 | using MvcPluginMasterApp.Plugin2.Services.Contracts; 6 | using MvcPluginMasterApp.PluginsBase; 7 | 8 | namespace MvcPluginMasterApp.Plugin2.Services 9 | { 10 | public class EfArticlesService : IArticlesService 11 | { 12 | IUnitOfWork _uow; 13 | readonly IDbSet
    _articles; 14 | public EfArticlesService(IUnitOfWork uow) 15 | { 16 | _uow = uow; 17 | _articles = _uow.Set
    (); 18 | } 19 | 20 | public void AddArticle(Article news) 21 | { 22 | _articles.Add(news); 23 | } 24 | 25 | public IList
    GetAllArticles() 26 | { 27 | return _articles.ToList(); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2.Services/MvcPluginMasterApp.Plugin2.Services.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {B2F2E110-59D8-4828-B2D0-9B6F267529D1} 8 | Library 9 | Properties 10 | MvcPluginMasterApp.Plugin2.Services 11 | MvcPluginMasterApp.Plugin2.Services 12 | v4.5 13 | 512 14 | ..\..\..\ 15 | true 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | false 27 | 28 | 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | false 36 | 37 | 38 | 39 | ..\..\..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll 40 | True 41 | 42 | 43 | ..\..\..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll 44 | True 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | {9c48d0fd-2c49-4475-8b92-53d5e0251305} 65 | MvcPluginMasterApp.PluginsBase 66 | 67 | 68 | {0d65ec8d-1950-40ac-a154-e2cd4cbc6141} 69 | MvcPluginMasterApp.Plugin2.DomainClasses 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 81 | 82 | 83 | 84 | 91 | -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2.Services/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MvcPluginMasterApp.Plugin2.Services")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MvcPluginMasterApp.Plugin2.Services")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("eb10bb3e-48e1-4931-83b2-d52fff61e030")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2.Services/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2/App_Start/Plugin2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using System.Web; 6 | using System.Web.Mvc; 7 | using System.Web.Optimization; 8 | using System.Web.Routing; 9 | using CommonEntities; 10 | using MvcPluginMasterApp.Common.WebToolkit; 11 | using MvcPluginMasterApp.Plugin2.DomainClasses; 12 | using MvcPluginMasterApp.Plugin2.Services; 13 | using MvcPluginMasterApp.Plugin2.Services.Contracts; 14 | using MvcPluginMasterApp.PluginsBase; 15 | 16 | namespace MvcPluginMasterApp.Plugin2 17 | { 18 | public class Plugin2 : IPlugin 19 | { 20 | public EfBootstrapper GetEfBootstrapper() 21 | { 22 | return new EfBootstrapper 23 | { 24 | DomainEntities = new[] { typeof(Article), typeof(User) }, 25 | ConfigurationsAssemblies = new[] 26 | { 27 | typeof(ArticlesConfig).Assembly, 28 | typeof(User).Assembly 29 | }, 30 | DatabaseSeeder = uow => 31 | { 32 | var news = uow.Set
    (); 33 | if (news.Any()) 34 | { 35 | return; 36 | } 37 | 38 | var users = uow.Set(); 39 | var user1 = users.Add(new User { Name = "User Plugin 2" }); 40 | 41 | news.Add(new Article 42 | { 43 | Title = "Article 1", 44 | Body = "data 1 data 1 data 1 ....", 45 | User = user1 46 | }); 47 | 48 | news.Add(new Article 49 | { 50 | Title = "Article 2", 51 | Body = "data 2 data 2 data 2 ....", 52 | User = user1 53 | }); 54 | } 55 | }; 56 | } 57 | 58 | public MenuItem GetMenuItem(RequestContext requestContext) 59 | { 60 | return new MenuItem 61 | { 62 | Name = "Plugin 2", 63 | Url = new UrlHelper(requestContext).Action("Index", "Home", new { area = "ArticlesArea" }) 64 | }; 65 | } 66 | 67 | public void RegisterBundles(BundleCollection bundles) 68 | { 69 | var executingAssembly = Assembly.GetExecutingAssembly(); 70 | 71 | // Mostly the default namespace and assembly name are the same 72 | var assemblyNameSpace = executingAssembly.GetName().Name; 73 | 74 | var scriptsBundle = new Bundle("~/Plugin2/Scripts", 75 | new EmbeddedResourceTransform(new List 76 | { 77 | assemblyNameSpace + ".Scripts.test2.js" 78 | }, "application/javascript", executingAssembly)); 79 | 80 | if (!HttpContext.Current.IsDebuggingEnabled) 81 | { 82 | scriptsBundle.Transforms.Add(new JsMinify()); 83 | } 84 | 85 | bundles.Add(scriptsBundle); 86 | 87 | var cssBundle = new Bundle("~/Plugin2/Content", 88 | new EmbeddedResourceTransform(new List 89 | { 90 | assemblyNameSpace + ".Content.test2.css" 91 | }, "text/css", executingAssembly)); 92 | 93 | if (!HttpContext.Current.IsDebuggingEnabled) 94 | { 95 | cssBundle.Transforms.Add(new CssMinify()); 96 | } 97 | 98 | bundles.Add(cssBundle); 99 | 100 | BundleTable.EnableOptimizations = true; 101 | } 102 | 103 | public void RegisterRoutes(RouteCollection routes) 104 | { 105 | //todo: add custom routes. 106 | 107 | var assembly = Assembly.GetExecutingAssembly(); 108 | // Mostly the default namespace and assembly name are the same 109 | var nameSpace = assembly.GetName().Name; 110 | var resourcePath = string.Format("{0}.Images", nameSpace); 111 | 112 | routes.Insert(0, 113 | new Route("ArticlesArea/Images/{file}.{extension}", 114 | new RouteValueDictionary(new { }), 115 | new RouteValueDictionary(new { extension = "png|jpg" }), 116 | new EmbeddedResourceRouteHandler(assembly, resourcePath, cacheDuration: TimeSpan.FromDays(30)) 117 | )); 118 | } 119 | 120 | public void RegisterServices(StructureMap.IContainer container) 121 | { 122 | // todo: add custom services. 123 | 124 | container.Configure(cfg => 125 | { 126 | cfg.For().Use(); 127 | }); 128 | } 129 | } 130 | } -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2/App_Start/RazorGeneratorMvcStart.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | using System.Web.WebPages; 4 | using MvcPluginMasterApp.Plugin2; 5 | using RazorGenerator.Mvc; 6 | 7 | [assembly: WebActivatorEx.PostApplicationStartMethod(typeof(RazorGeneratorMvcStart), "Start")] 8 | 9 | namespace MvcPluginMasterApp.Plugin2 { 10 | public static class RazorGeneratorMvcStart { 11 | public static void Start() { 12 | var engine = new PrecompiledMvcEngine(typeof(RazorGeneratorMvcStart).Assembly) { 13 | UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal 14 | }; 15 | 16 | ViewEngines.Engines.Insert(0, engine); 17 | 18 | // StartPage lookups are done by WebPages. 19 | VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2/Areas/ArticlesArea/ArticlesAreaAreaRegistration.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Mvc; 2 | 3 | namespace MvcPluginMasterApp.Plugin2.Areas.ArticlesArea 4 | { 5 | public class ArticlesAreaAreaRegistration : AreaRegistration 6 | { 7 | public override string AreaName 8 | { 9 | get 10 | { 11 | return "ArticlesArea"; 12 | } 13 | } 14 | 15 | public override void RegisterArea(AreaRegistrationContext context) 16 | { 17 | context.MapRoute( 18 | "ArticlesArea_default", 19 | "ArticlesArea/{controller}/{action}/{id}", 20 | // تكميل نام كنترلر پيش فرض 21 | new { controller = "Home", action = "Index", id = UrlParameter.Optional }, 22 | // مشخص كردن فضاي نام مرتبط جهت جلوگيري از تداخل با ساير قسمت‌هاي برنامه 23 | namespaces: new[] { string.Format("{0}.Controllers", this.GetType().Namespace) } 24 | 25 | ); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2/Areas/ArticlesArea/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Mvc; 2 | using MvcPluginMasterApp.Plugin2.Services.Contracts; 3 | 4 | namespace MvcPluginMasterApp.Plugin2.Areas.ArticlesArea.Controllers 5 | { 6 | public class HomeController : Controller 7 | { 8 | private readonly IConfigService _configService; 9 | private readonly IArticlesService _articlesService; 10 | 11 | public HomeController(IConfigService configService, IArticlesService articlesService) 12 | { 13 | _configService = configService; 14 | _articlesService = articlesService; 15 | } 16 | 17 | public ActionResult Index() 18 | { 19 | ViewBag.Message = string.Format("From Plugin2: {0}", _configService.Key2); 20 | var articlesList = _articlesService.GetAllArticles(); 21 | return View(model: articlesList); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2/Areas/ArticlesArea/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @using MvcPluginMasterApp.Plugin2.DomainClasses 2 | @model IList
    3 | @{ 4 | ViewBag.Title = "From Plugin 2"; 5 | } 6 | @Styles.Render("~/Plugin2/Content") 7 | 8 |

    @ViewBag.Message

    9 | 10 |
    11 | Embedded image: 12 | clock 13 |
    14 | 15 |
    16 |
      17 | @foreach (var item in Model) 18 | { 19 |
    • @item.Title
    • 20 | } 21 |
    22 |
    23 | 24 | @section scripts 25 | { 26 | @Scripts.Render("~/Plugin2/Scripts") 27 | } 28 | -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2/Areas/ArticlesArea/Views/Home/Index.generated.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable 1591 2 | //------------------------------------------------------------------------------ 3 | // 4 | // This code was generated by a tool. 5 | // Runtime Version:4.0.30319.42000 6 | // 7 | // Changes to this file may cause incorrect behavior and will be lost if 8 | // the code is regenerated. 9 | // 10 | //------------------------------------------------------------------------------ 11 | 12 | namespace ASP 13 | { 14 | using System; 15 | using System.Collections.Generic; 16 | using System.IO; 17 | using System.Linq; 18 | using System.Net; 19 | using System.Text; 20 | using System.Web; 21 | using System.Web.Helpers; 22 | using System.Web.Mvc; 23 | using System.Web.Mvc.Ajax; 24 | using System.Web.Mvc.Html; 25 | using System.Web.Optimization; 26 | using System.Web.Routing; 27 | using System.Web.Security; 28 | using System.Web.UI; 29 | using System.Web.WebPages; 30 | 31 | #line 1 "..\..\Areas\ArticlesArea\Views\Home\Index.cshtml" 32 | using MvcPluginMasterApp.Plugin2.DomainClasses; 33 | 34 | #line default 35 | #line hidden 36 | 37 | [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")] 38 | [System.Web.WebPages.PageVirtualPathAttribute("~/Areas/ArticlesArea/Views/Home/Index.cshtml")] 39 | public partial class _Areas_ArticlesArea_Views_Home_Index_cshtml : System.Web.Mvc.WebViewPage> 40 | { 41 | public _Areas_ArticlesArea_Views_Home_Index_cshtml() 42 | { 43 | } 44 | public override void Execute() 45 | { 46 | 47 | #line 3 "..\..\Areas\ArticlesArea\Views\Home\Index.cshtml" 48 | 49 | ViewBag.Title = "From Plugin 2"; 50 | 51 | 52 | #line default 53 | #line hidden 54 | WriteLiteral("\r\n"); 55 | 56 | 57 | #line 6 "..\..\Areas\ArticlesArea\Views\Home\Index.cshtml" 58 | Write(Styles.Render("~/Plugin2/Content")); 59 | 60 | 61 | #line default 62 | #line hidden 63 | WriteLiteral("\r\n\r\n

    "); 64 | 65 | 66 | #line 8 "..\..\Areas\ArticlesArea\Views\Home\Index.cshtml" 67 | Write(ViewBag.Message); 68 | 69 | 70 | #line default 71 | #line hidden 72 | WriteLiteral("

    \r\n\r\n\r\n Embedded image:\r\n (Url.Content("~/ArticlesArea/Images/clock.png") 82 | 83 | #line default 84 | #line hidden 85 | , 239), false) 86 | ); 87 | 88 | WriteLiteral(" alt=\"clock\""); 89 | 90 | WriteLiteral(" />\r\n\r\n\r\n\r\n
      \r\n"); 95 | 96 | 97 | #line 17 "..\..\Areas\ArticlesArea\Views\Home\Index.cshtml" 98 | 99 | 100 | #line default 101 | #line hidden 102 | 103 | #line 17 "..\..\Areas\ArticlesArea\Views\Home\Index.cshtml" 104 | foreach (var item in Model) 105 | { 106 | 107 | 108 | #line default 109 | #line hidden 110 | WriteLiteral("
    • "); 111 | 112 | 113 | #line 19 "..\..\Areas\ArticlesArea\Views\Home\Index.cshtml" 114 | Write(item.Title); 115 | 116 | 117 | #line default 118 | #line hidden 119 | WriteLiteral("
    • \r\n"); 120 | 121 | 122 | #line 20 "..\..\Areas\ArticlesArea\Views\Home\Index.cshtml" 123 | } 124 | 125 | 126 | #line default 127 | #line hidden 128 | WriteLiteral("
    \r\n\r\n\r\n"); 129 | 130 | DefineSection("scripts", () => { 131 | 132 | WriteLiteral("\r\n"); 133 | 134 | WriteLiteral(" "); 135 | 136 | 137 | #line 26 "..\..\Areas\ArticlesArea\Views\Home\Index.cshtml" 138 | Write(Scripts.Render("~/Plugin2/Scripts")); 139 | 140 | 141 | #line default 142 | #line hidden 143 | WriteLiteral("\r\n"); 144 | 145 | }); 146 | 147 | } 148 | } 149 | } 150 | #pragma warning restore 1591 151 | -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2/Areas/ArticlesArea/Views/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 |
    7 |
    8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 40 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2/Areas/ArticlesArea/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2/Areas/ArticlesArea/Views/_ViewStart.generated.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable 1591 2 | //------------------------------------------------------------------------------ 3 | // 4 | // This code was generated by a tool. 5 | // Runtime Version:4.0.30319.42000 6 | // 7 | // Changes to this file may cause incorrect behavior and will be lost if 8 | // the code is regenerated. 9 | // 10 | //------------------------------------------------------------------------------ 11 | 12 | namespace ASP 13 | { 14 | using System; 15 | using System.Collections.Generic; 16 | using System.IO; 17 | using System.Linq; 18 | using System.Net; 19 | using System.Text; 20 | using System.Web; 21 | using System.Web.Helpers; 22 | using System.Web.Mvc; 23 | using System.Web.Mvc.Ajax; 24 | using System.Web.Mvc.Html; 25 | using System.Web.Optimization; 26 | using System.Web.Routing; 27 | using System.Web.Security; 28 | using System.Web.UI; 29 | using System.Web.WebPages; 30 | 31 | [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")] 32 | [System.Web.WebPages.PageVirtualPathAttribute("~/Areas/ArticlesArea/Views/_ViewStart.cshtml")] 33 | public partial class _Areas_ArticlesArea_Views__ViewStart_cshtml : System.Web.Mvc.ViewStartPage 34 | { 35 | public _Areas_ArticlesArea_Views__ViewStart_cshtml() 36 | { 37 | } 38 | public override void Execute() 39 | { 40 | 41 | #line 1 "..\..\Areas\ArticlesArea\Views\_ViewStart.cshtml" 42 | 43 | Layout = "~/Views/Shared/_Layout.cshtml"; 44 | 45 | 46 | #line default 47 | #line hidden 48 | } 49 | } 50 | } 51 | #pragma warning restore 1591 52 | -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2/Content/test2.css: -------------------------------------------------------------------------------- 1 | h2 2 | { 3 | color: blue; 4 | } -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2/Images/clock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VahidN/MvcPlugin/4b98b552d16b6d8b1374459c9ef40fa2d0625041/Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2/Images/clock.png -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MvcPluginMasterApp.Plugin2")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MvcPluginMasterApp.Plugin2")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("2cc19365-788b-4390-991f-6c141c509fb5")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2/Scripts/test2.js: -------------------------------------------------------------------------------- 1 | alert('Running the embedded script from Plugin2'); -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 |
    10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /Plugins/ArticlesPlugin/MvcPluginMasterApp.Plugin2/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Plugins/CommonEntities/CommonEntities/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
    6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Plugins/CommonEntities/CommonEntities/CommonEntities.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {193814D6-EBED-4F59-B716-79515E373DC1} 8 | Library 9 | Properties 10 | CommonEntities 11 | CommonEntities 12 | v4.5 13 | 512 14 | ..\..\..\ 15 | true 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | false 27 | 28 | 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | false 36 | 37 | 38 | 39 | ..\..\..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll 40 | True 41 | 42 | 43 | ..\..\..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll 44 | True 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 68 | 69 | 70 | 71 | 78 | -------------------------------------------------------------------------------- /Plugins/CommonEntities/CommonEntities/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CommonEntities")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CommonEntities")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("d8249b7f-0346-406f-bf7b-b56343a8de4d")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Plugins/CommonEntities/CommonEntities/User.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace CommonEntities 5 | { 6 | public class User 7 | { 8 | public int Id { set; get; } 9 | 10 | [Index(IsUnique = true)] 11 | [MaxLength(450)] 12 | [Required] 13 | public string Name { set; get; } 14 | } 15 | } -------------------------------------------------------------------------------- /Plugins/CommonEntities/CommonEntities/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1.DomainClasses/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
    6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1.DomainClasses/MvcPluginMasterApp.Plugin1.DomainClasses.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {5E3600A2-88D1-4B88-B7C9-D50286C5B49C} 8 | Library 9 | Properties 10 | MvcPluginMasterApp.Plugin1.DomainClasses 11 | MvcPluginMasterApp.Plugin1.DomainClasses 12 | v4.5 13 | 512 14 | ..\..\..\ 15 | true 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | false 27 | 28 | 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | false 36 | 37 | 38 | 39 | ..\..\..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll 40 | True 41 | 42 | 43 | ..\..\..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll 44 | True 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | {193814d6-ebed-4f59-b716-79515e373dc1} 66 | CommonEntities 67 | 68 | 69 | {fe274386-fa07-4e7a-b782-5163f6143800} 70 | MvcPluginMasterApp.Plugin1.Resources 71 | 72 | 73 | 74 | 75 | 76 | 77 | This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 78 | 79 | 80 | 81 | 88 | -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1.DomainClasses/News.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | using System.Data.Entity.ModelConfiguration; 4 | using CommonEntities; 5 | 6 | namespace MvcPluginMasterApp.Plugin1.DomainClasses 7 | { 8 | public class News 9 | { 10 | [ScaffoldColumn(false)] 11 | public int Id { set; get; } 12 | 13 | [Display(ResourceType = typeof(MvcPluginMasterApp.Plugin1.Resources.Home_Index_cshtml), 14 | Name = "Title")] 15 | public string Title { set; get; } 16 | 17 | [Display(ResourceType = typeof(MvcPluginMasterApp.Plugin1.Resources.Home_Index_cshtml), 18 | Name = "Body")] 19 | public string Body { set; get; } 20 | 21 | [ScaffoldColumn(false)] 22 | [ForeignKey("UserId")] 23 | public virtual User User { set; get; } 24 | 25 | [ScaffoldColumn(false)] 26 | public int UserId { set; get; } 27 | } 28 | 29 | public class NewsConfig : EntityTypeConfiguration 30 | { 31 | public NewsConfig() 32 | { 33 | this.ToTable("Plugin1_News"); 34 | this.HasKey(news => news.Id); 35 | this.Property(news => news.Title).IsRequired().HasMaxLength(500); 36 | this.Property(news => news.Body).IsOptional().IsMaxLength(); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1.DomainClasses/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MvcPluginMasterApp.Plugin1.DomainClasses")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MvcPluginMasterApp.Plugin1.DomainClasses")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("355acd94-fb73-4170-9bb5-b4c2f71b5a02")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1.DomainClasses/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1.Resources/Home_Index_cshtml.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace MvcPluginMasterApp.Plugin1.Resources { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | public class Home_Index_cshtml { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Home_Index_cshtml() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | public static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MvcPluginMasterApp.Plugin1.Resources.Home_Index_cshtml", typeof(Home_Index_cshtml).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | public static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized string similar to News Description. 65 | /// 66 | public static string Body { 67 | get { 68 | return ResourceManager.GetString("Body", resourceCulture); 69 | } 70 | } 71 | 72 | /// 73 | /// Looks up a localized string similar to Title. 74 | /// 75 | public static string Title { 76 | get { 77 | return ResourceManager.GetString("Title", resourceCulture); 78 | } 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1.Resources/Home_Index_cshtml.fa.Designer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VahidN/MvcPlugin/4b98b552d16b6d8b1374459c9ef40fa2d0625041/Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1.Resources/Home_Index_cshtml.fa.Designer.cs -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1.Resources/MvcPluginMasterApp.Plugin1.Resources.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {FE274386-FA07-4E7A-B782-5163F6143800} 8 | Library 9 | Properties 10 | MvcPluginMasterApp.Plugin1.Resources 11 | MvcPluginMasterApp.Plugin1.Resources 12 | v4.5 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | false 25 | 26 | 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | false 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | True 47 | True 48 | Home_Index_cshtml.resx 49 | 50 | 51 | True 52 | True 53 | Home_Index_cshtml.fa.resx 54 | 55 | 56 | 57 | 58 | 59 | PublicResXFileCodeGenerator 60 | Home_Index_cshtml.fa.Designer.cs 61 | 62 | 63 | PublicResXFileCodeGenerator 64 | Home_Index_cshtml.Designer.cs 65 | 66 | 67 | 68 | 75 | -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1.Resources/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MvcPluginMasterApp.Plugin1.Resources")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MvcPluginMasterApp.Plugin1.Resources")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("f0e97307-a969-4cb1-894b-d0a5b81559bc")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1.Services/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
    6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1.Services/ConfigService.cs: -------------------------------------------------------------------------------- 1 | using MvcPluginMasterApp.Plugin1.Services.Contracts; 2 | 3 | namespace MvcPluginMasterApp.Plugin1.Services 4 | { 5 | public class ConfigService : IConfigService 6 | { 7 | public string Key1 8 | { 9 | get { return "Value 1"; } 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1.Services/Contracts/IConfigService.cs: -------------------------------------------------------------------------------- 1 | namespace MvcPluginMasterApp.Plugin1.Services.Contracts 2 | { 3 | public interface IConfigService 4 | { 5 | string Key1 { get; } 6 | } 7 | } -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1.Services/Contracts/INewsService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using MvcPluginMasterApp.Plugin1.DomainClasses; 3 | 4 | namespace MvcPluginMasterApp.Plugin1.Services.Contracts 5 | { 6 | public interface INewsService 7 | { 8 | void AddNews(News news); 9 | IList GetAllNews(); 10 | } 11 | } -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1.Services/EfNewsService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Data.Entity; 3 | using System.Linq; 4 | using MvcPluginMasterApp.Plugin1.DomainClasses; 5 | using MvcPluginMasterApp.Plugin1.Services.Contracts; 6 | using MvcPluginMasterApp.PluginsBase; 7 | 8 | namespace MvcPluginMasterApp.Plugin1.Services 9 | { 10 | public class EfNewsService:INewsService 11 | { 12 | IUnitOfWork _uow; 13 | readonly IDbSet _news; 14 | public EfNewsService(IUnitOfWork uow) 15 | { 16 | _uow = uow; 17 | _news = _uow.Set(); 18 | } 19 | 20 | public void AddNews(News news) 21 | { 22 | _news.Add(news); 23 | } 24 | 25 | public IList GetAllNews() 26 | { 27 | return _news.ToList(); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1.Services/MvcPluginMasterApp.Plugin1.Services.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {6B992E60-7178-4650-A930-72D8A07165AE} 8 | Library 9 | Properties 10 | MvcPluginMasterApp.Plugin1.Services 11 | MvcPluginMasterApp.Plugin1.Services 12 | v4.5 13 | 512 14 | ..\..\..\ 15 | true 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | false 27 | 28 | 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | false 36 | 37 | 38 | 39 | ..\..\..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll 40 | True 41 | 42 | 43 | ..\..\..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll 44 | True 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | {9c48d0fd-2c49-4475-8b92-53d5e0251305} 65 | MvcPluginMasterApp.PluginsBase 66 | 67 | 68 | {5e3600a2-88d1-4b88-b7c9-d50286c5b49c} 69 | MvcPluginMasterApp.Plugin1.DomainClasses 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 81 | 82 | 83 | 84 | 91 | -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1.Services/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MvcPluginMasterApp.Plugin1.Services")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MvcPluginMasterApp.Plugin1.Services")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("e1baf14b-6af1-4a44-8f32-8e0475018e0f")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1.Services/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1/App_Start/Plugin1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using System.Web; 6 | using System.Web.Mvc; 7 | using System.Web.Optimization; 8 | using System.Web.Routing; 9 | using CommonEntities; 10 | using MvcPluginMasterApp.Common.WebToolkit; 11 | using MvcPluginMasterApp.Plugin1.DomainClasses; 12 | using MvcPluginMasterApp.Plugin1.Services; 13 | using MvcPluginMasterApp.Plugin1.Services.Contracts; 14 | using MvcPluginMasterApp.PluginsBase; 15 | 16 | namespace MvcPluginMasterApp.Plugin1 17 | { 18 | public class Plugin1 : IPlugin 19 | { 20 | public EfBootstrapper GetEfBootstrapper() 21 | { 22 | return new EfBootstrapper 23 | { 24 | DomainEntities = new[] { typeof(News), typeof(User) }, 25 | ConfigurationsAssemblies = new[] 26 | { 27 | typeof(NewsConfig).Assembly, 28 | typeof(User).Assembly 29 | }, 30 | DatabaseSeeder = uow => 31 | { 32 | var news = uow.Set(); 33 | if (news.Any()) 34 | { 35 | return; 36 | } 37 | 38 | var users = uow.Set(); 39 | var user1 = users.Add(new User { Name = "User Plugin 1" }); 40 | 41 | news.Add(new News 42 | { 43 | Title = "News 1", 44 | Body = "news 1 news 1 news 1 ....", 45 | User = user1 46 | }); 47 | 48 | news.Add(new News 49 | { 50 | Title = "News 2", 51 | Body = "news 2 news 2 news 2 ....", 52 | User = user1 53 | }); 54 | } 55 | }; 56 | } 57 | 58 | public MenuItem GetMenuItem(RequestContext requestContext) 59 | { 60 | return new MenuItem 61 | { 62 | Name = "Plugin 1", 63 | Url = new UrlHelper(requestContext).Action("Index", "Home", new { area = "NewsArea" }) 64 | }; 65 | } 66 | 67 | public void RegisterBundles(BundleCollection bundles) 68 | { 69 | var executingAssembly = Assembly.GetExecutingAssembly(); 70 | 71 | // Mostly the default namespace and assembly name are the same 72 | var assemblyNameSpace = executingAssembly.GetName().Name; 73 | 74 | var scriptsBundle = new Bundle("~/Plugin1/Scripts", 75 | new EmbeddedResourceTransform(new List 76 | { 77 | assemblyNameSpace + ".Scripts.test1.js" 78 | }, "application/javascript", executingAssembly)); 79 | 80 | if (!HttpContext.Current.IsDebuggingEnabled) 81 | { 82 | scriptsBundle.Transforms.Add(new JsMinify()); 83 | } 84 | 85 | bundles.Add(scriptsBundle); 86 | 87 | var cssBundle = new Bundle("~/Plugin1/Content", 88 | new EmbeddedResourceTransform(new List 89 | { 90 | assemblyNameSpace + ".Content.test1.css" 91 | }, "text/css", executingAssembly)); 92 | 93 | if (!HttpContext.Current.IsDebuggingEnabled) 94 | { 95 | cssBundle.Transforms.Add(new CssMinify()); 96 | } 97 | 98 | bundles.Add(cssBundle); 99 | 100 | BundleTable.EnableOptimizations = true; 101 | } 102 | 103 | public void RegisterRoutes(RouteCollection routes) 104 | { 105 | //todo: add custom routes. 106 | 107 | var assembly = Assembly.GetExecutingAssembly(); 108 | // Mostly the default namespace and assembly name are the same 109 | var nameSpace = assembly.GetName().Name; 110 | var resourcePath = string.Format("{0}.Images", nameSpace); 111 | 112 | routes.Insert(0, 113 | new Route("NewsArea/Images/{file}.{extension}", 114 | new RouteValueDictionary(new { }), 115 | new RouteValueDictionary(new { extension = "png|jpg" }), 116 | new EmbeddedResourceRouteHandler(assembly, resourcePath, cacheDuration: TimeSpan.FromDays(30)) 117 | )); 118 | } 119 | 120 | public void RegisterServices(StructureMap.IContainer container) 121 | { 122 | // todo: add custom services. 123 | 124 | container.Configure(cfg => 125 | { 126 | cfg.For().Use(); 127 | }); 128 | } 129 | } 130 | } -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1/App_Start/RazorGeneratorMvcStart.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | using System.Web.WebPages; 4 | using MvcPluginMasterApp.Plugin1; 5 | using RazorGenerator.Mvc; 6 | 7 | [assembly: WebActivatorEx.PostApplicationStartMethod(typeof(RazorGeneratorMvcStart), "Start")] 8 | 9 | namespace MvcPluginMasterApp.Plugin1 { 10 | public static class RazorGeneratorMvcStart { 11 | public static void Start() { 12 | var engine = new PrecompiledMvcEngine(typeof(RazorGeneratorMvcStart).Assembly) { 13 | UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal 14 | }; 15 | 16 | ViewEngines.Engines.Insert(0, engine); 17 | 18 | // StartPage lookups are done by WebPages. 19 | VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1/Areas/NewsArea/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Mvc; 2 | using MvcPluginMasterApp.Plugin1.DomainClasses; 3 | using MvcPluginMasterApp.Plugin1.Services.Contracts; 4 | 5 | namespace MvcPluginMasterApp.Plugin1.Areas.NewsArea.Controllers 6 | { 7 | public class HomeController : Controller 8 | { 9 | private readonly IConfigService _configService; 10 | private readonly INewsService _newsService; 11 | 12 | public HomeController(IConfigService configService, INewsService newsService) 13 | { 14 | _configService = configService; 15 | _newsService = newsService; 16 | } 17 | 18 | public ActionResult Index() 19 | { 20 | ViewBag.Message = string.Format("From Plugin1: {0}", _configService.Key1); 21 | var newsList = _newsService.GetAllNews(); 22 | return View(model: newsList); 23 | } 24 | 25 | public ActionResult ShowResources() 26 | { 27 | /* 28 | 29 | 30 | */ 31 | var model = new News {Title = "Title 1", Body = "Body 1"}; 32 | return View(model); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1/Areas/NewsArea/NewsAreaAreaRegistration.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Mvc; 2 | 3 | namespace MvcPluginMasterApp.Plugin1.Areas.NewsArea 4 | { 5 | public class NewsAreaAreaRegistration : AreaRegistration 6 | { 7 | public override string AreaName 8 | { 9 | get 10 | { 11 | return "NewsArea"; 12 | } 13 | } 14 | 15 | public override void RegisterArea(AreaRegistrationContext context) 16 | { 17 | context.MapRoute( 18 | "NewsArea_default", 19 | "NewsArea/{controller}/{action}/{id}", 20 | // تكميل نام كنترلر پيش فرض 21 | new { controller = "Home", action = "Index", id = UrlParameter.Optional }, 22 | // مشخص كردن فضاي نام مرتبط جهت جلوگيري از تداخل با ساير قسمت‌هاي برنامه 23 | namespaces: new[] { string.Format("{0}.Controllers", this.GetType().Namespace) } 24 | ); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1/Areas/NewsArea/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @using MvcPluginMasterApp.Plugin1.DomainClasses 2 | @model IList 3 | @{ 4 | ViewBag.Title = "From Plugin 1"; 5 | } 6 | @Styles.Render("~/Plugin1/Content") 7 | 8 |

    @ViewBag.Message

    9 | 10 |
    11 | Embedded image: 12 | clock 13 |
    14 | 15 |
    16 |
      17 | @foreach (var item in Model) 18 | { 19 |
    • @MvcPluginMasterApp.Plugin1.Resources.Home_Index_cshtml.Title : @item.Title
    • 20 | } 21 |
    22 |
    23 | 24 | @Html.ActionLink("Show Resources", "ShowResources", "Home", new { area = "NewsArea" }, null) 25 | 26 | @section scripts 27 | { 28 | @Scripts.Render("~/Plugin1/Scripts") 29 | } 30 | -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1/Areas/NewsArea/Views/Home/ShowResources.cshtml: -------------------------------------------------------------------------------- 1 | @using MvcPluginMasterApp.Plugin1.DomainClasses 2 | @model News 3 | @{ 4 | ViewBag.Title = "Show Resources"; 5 | } 6 | @Styles.Render("~/Plugin1/Content") 7 | 8 |

    @ViewBag.Message

    9 | 10 | 11 |
    12 |
    13 | News Info (@@Home_Index_cshtml.Title) 14 | CurrentCulture: @System.Threading.Thread.CurrentThread.CurrentCulture.ToString() 15 |
    @MvcPluginMasterApp.Plugin1.Resources.Home_Index_cshtml.Title
    16 |
    17 | @Html.DisplayFor(model => model.Title) 18 |
    19 |
    20 |
    21 | 22 |
    23 |
    24 | News Info (@@Html.DisplayForModel) 25 | @Html.DisplayForModel() 26 |
    27 |
    28 | 29 | 30 | @section scripts 31 | { 32 | @Scripts.Render("~/Plugin1/Scripts") 33 | } 34 | -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1/Areas/NewsArea/Views/Home/ShowResources.generated.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable 1591 2 | //------------------------------------------------------------------------------ 3 | // 4 | // This code was generated by a tool. 5 | // Runtime Version:4.0.30319.42000 6 | // 7 | // Changes to this file may cause incorrect behavior and will be lost if 8 | // the code is regenerated. 9 | // 10 | //------------------------------------------------------------------------------ 11 | 12 | namespace ASP 13 | { 14 | using System; 15 | using System.Collections.Generic; 16 | using System.IO; 17 | using System.Linq; 18 | using System.Net; 19 | using System.Text; 20 | using System.Web; 21 | using System.Web.Helpers; 22 | using System.Web.Mvc; 23 | using System.Web.Mvc.Ajax; 24 | using System.Web.Mvc.Html; 25 | using System.Web.Optimization; 26 | using System.Web.Routing; 27 | using System.Web.Security; 28 | using System.Web.UI; 29 | using System.Web.WebPages; 30 | 31 | #line 1 "..\..\Areas\NewsArea\Views\Home\ShowResources.cshtml" 32 | using MvcPluginMasterApp.Plugin1.DomainClasses; 33 | 34 | #line default 35 | #line hidden 36 | 37 | [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")] 38 | [System.Web.WebPages.PageVirtualPathAttribute("~/Areas/NewsArea/Views/Home/ShowResources.cshtml")] 39 | public partial class _Areas_NewsArea_Views_Home_ShowResources_cshtml : System.Web.Mvc.WebViewPage 40 | { 41 | public _Areas_NewsArea_Views_Home_ShowResources_cshtml() 42 | { 43 | } 44 | public override void Execute() 45 | { 46 | 47 | #line 3 "..\..\Areas\NewsArea\Views\Home\ShowResources.cshtml" 48 | 49 | ViewBag.Title = "Show Resources"; 50 | 51 | 52 | #line default 53 | #line hidden 54 | WriteLiteral("\r\n"); 55 | 56 | 57 | #line 6 "..\..\Areas\NewsArea\Views\Home\ShowResources.cshtml" 58 | Write(Styles.Render("~/Plugin1/Content")); 59 | 60 | 61 | #line default 62 | #line hidden 63 | WriteLiteral("\r\n\r\n

    "); 64 | 65 | 66 | #line 8 "..\..\Areas\NewsArea\Views\Home\ShowResources.cshtml" 67 | Write(ViewBag.Message); 68 | 69 | 70 | #line default 71 | #line hidden 72 | WriteLiteral("

    \r\n\r\n\r\n\r\n
    \r\n News Info ("); 77 | 78 | WriteLiteral("@Home_Index_cshtml.Title)\r\n CurrentCulture: "); 79 | 80 | 81 | #line 14 "..\..\Areas\NewsArea\Views\Home\ShowResources.cshtml" 82 | Write(System.Threading.Thread.CurrentThread.CurrentCulture.ToString()); 83 | 84 | 85 | #line default 86 | #line hidden 87 | WriteLiteral("\r\n "); 92 | 93 | 94 | #line 15 "..\..\Areas\NewsArea\Views\Home\ShowResources.cshtml" 95 | Write(MvcPluginMasterApp.Plugin1.Resources.Home_Index_cshtml.Title); 96 | 97 | 98 | #line default 99 | #line hidden 100 | WriteLiteral("\r\n \r\n"); 105 | 106 | WriteLiteral(" "); 107 | 108 | 109 | #line 17 "..\..\Areas\NewsArea\Views\Home\ShowResources.cshtml" 110 | Write(Html.DisplayFor(model => model.Title)); 111 | 112 | 113 | #line default 114 | #line hidden 115 | WriteLiteral("\r\n \r\n
    \r\n\r\n\r\n\r\n
    \r\n News Info ("); 120 | 121 | WriteLiteral("@Html.DisplayForModel)\r\n"); 122 | 123 | WriteLiteral(" "); 124 | 125 | 126 | #line 25 "..\..\Areas\NewsArea\Views\Home\ShowResources.cshtml" 127 | Write(Html.DisplayForModel()); 128 | 129 | 130 | #line default 131 | #line hidden 132 | WriteLiteral("\r\n
    \r\n\r\n\r\n\r\n"); 133 | 134 | DefineSection("scripts", () => { 135 | 136 | WriteLiteral("\r\n"); 137 | 138 | WriteLiteral(" "); 139 | 140 | 141 | #line 32 "..\..\Areas\NewsArea\Views\Home\ShowResources.cshtml" 142 | Write(Scripts.Render("~/Plugin1/Scripts")); 143 | 144 | 145 | #line default 146 | #line hidden 147 | WriteLiteral("\r\n"); 148 | 149 | }); 150 | 151 | } 152 | } 153 | } 154 | #pragma warning restore 1591 155 | -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1/Areas/NewsArea/Views/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 |
    7 |
    8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 40 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1/Areas/NewsArea/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1/Areas/NewsArea/Views/_ViewStart.generated.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable 1591 2 | //------------------------------------------------------------------------------ 3 | // 4 | // This code was generated by a tool. 5 | // Runtime Version:4.0.30319.42000 6 | // 7 | // Changes to this file may cause incorrect behavior and will be lost if 8 | // the code is regenerated. 9 | // 10 | //------------------------------------------------------------------------------ 11 | 12 | namespace ASP 13 | { 14 | using System; 15 | using System.Collections.Generic; 16 | using System.IO; 17 | using System.Linq; 18 | using System.Net; 19 | using System.Text; 20 | using System.Web; 21 | using System.Web.Helpers; 22 | using System.Web.Mvc; 23 | using System.Web.Mvc.Ajax; 24 | using System.Web.Mvc.Html; 25 | using System.Web.Optimization; 26 | using System.Web.Routing; 27 | using System.Web.Security; 28 | using System.Web.UI; 29 | using System.Web.WebPages; 30 | 31 | [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")] 32 | [System.Web.WebPages.PageVirtualPathAttribute("~/Areas/NewsArea/Views/_ViewStart.cshtml")] 33 | public partial class _Areas_NewsArea_Views__ViewStart_cshtml : System.Web.Mvc.ViewStartPage 34 | { 35 | public _Areas_NewsArea_Views__ViewStart_cshtml() 36 | { 37 | } 38 | public override void Execute() 39 | { 40 | 41 | #line 1 "..\..\Areas\NewsArea\Views\_ViewStart.cshtml" 42 | 43 | Layout = "~/Views/Shared/_Layout.cshtml"; 44 | 45 | 46 | #line default 47 | #line hidden 48 | } 49 | } 50 | } 51 | #pragma warning restore 1591 52 | -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1/Content/test1.css: -------------------------------------------------------------------------------- 1 | h2 2 | { 3 | color: red; 4 | } -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1/Images/chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VahidN/MvcPlugin/4b98b552d16b6d8b1374459c9ef40fa2d0625041/Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1/Images/chart.png -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1/MvcPluginMasterApp.Plugin1.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | SpecificPage 10 | True 11 | False 12 | False 13 | False 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | True 23 | True 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MvcPluginMasterApp.Plugin1")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MvcPluginMasterApp.Plugin1")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("f0b3f442-0531-4f13-98a6-fbc4fc681e38")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1/Scripts/test1.js: -------------------------------------------------------------------------------- 1 | alert('Running the embedded script from Plugin1'); -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /Plugins/NewsPlugin/MvcPluginMasterApp.Plugin1/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | MvcPlugin 2 | ======= 3 | * How to create plugins for ASP.NET MVC 4.x/5.x applications. 4 | * How to move areas to another assemblies. 5 | * How to use embedded views. 6 | * How to read CSS and JS files from embedded resources. 7 | * How to read images from embedded resources. 8 | * How to apply dependency injection in different modules. 9 | * How to use Entity framework and discover entities and their configurations dynamically. --------------------------------------------------------------------------------