Skip to content

Commit 442cc51

Browse files
committed
2 parents b236b57 + 763e718 commit 442cc51

File tree

372 files changed

+2560
-5723
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

372 files changed

+2560
-5723
lines changed

.gitignore

+8-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@
55
# Logs
66
Logs/
77

8+
# Generated files
9+
project.lock.json
10+
.vs/
11+
812
# Nuget packages
913
nupkg/*.nupkg
10-
nupkg/push_abp_framework.bat
14+
nupkg/push.bat
1115

1216
# Profile images
1317
ProfileImages/
@@ -119,4 +123,6 @@ UpgradeLog*.XML
119123
src/.vs/config/applicationhost.config
120124

121125
# GitLink
122-
!GitLink.exe
126+
!GitLink.exe
127+
!nuget.exe
128+
!SQLite.Interop.dll

Abp.sln

+230
Large diffs are not rendered by default.

AbpLayers.png

-17.4 KB
Binary file not shown.

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
ASP.NET Boilerplate
33
===================
44

5+
AppVeyor: [![Build status](https://ci.appveyor.com/api/projects/status/tvad583r9lbimxh4?svg=true)](https://ci.appveyor.com/project/hikalkan/aspnetboilerplate)
6+
57
What is ABP?
68
------------
79

appveyor.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: 1.0.{build}
2+
before_build:
3+
- cmd: dotnet.exe restore
4+
build:
5+
verbosity: minimal
6+
test:
7+
assemblies:
8+
- test\Abp.AutoMapper.Tests\bin\Debug\net452\win7-x64\Abp.AutoMapper.dll
9+
- test\Abp.EntityFramework.Tests\bin\Debug\net452\win7-x64\Abp.EntityFramework.Tests.dll
10+
- test\Abp.MemoryDb.Tests\bin\Debug\net452\win7-x64\Abp.MemoryDb.Tests.dll
11+
- test\Abp.NHibernate.Tests\bin\Debug\net452\win7-x64\Abp.NHibernate.Tests.dll
12+
- test\Abp.TestBase.SampleApplication.Tests\bin\Debug\net452\win7-x64\Abp.TestBase.SampleApplication.Tests.dll
13+
- test\Abp.TestBase.Tests\bin\Debug\net452\win7-x64\Abp.TestBase.Tests.dll
14+
- test\Abp.Tests\bin\Debug\net452\win7-x64\Abp.Tests.dll
15+
- test\Abp.Web.Api.Tests\bin\Debug\net452\win7-x64\Abp.Web.Api.Tests.dll
16+
- test\Abp.Web.Mvc.Tests\bin\Debug\net452\win7-x64\Abp.Web.Mvc.Tests.dll
17+
- test\Abp.Web.Tests\bin\Debug\net452\win7-x64\Abp.Web.Tests.dll

doc/WebSite/Caching.html

+89
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,95 @@ <h3>Configuration</h3>
114114
first request). Configuration is not restricted to DefaultSlidingExpireTime
115115
only, since cache object is an ICache, you can use it's properties and methods
116116
freely configure and initialize it.</p>
117+
<h3>Entity Caching</h3>
118+
<p>While ASP.NET Boilerplate's cache system is general purpose,
119+
there is an <strong>EntityCache </strong> base class that can help you if you want to
120+
cache entities. We can use this base class if we get entities by
121+
their Ids and we want to <strong>cache them by Id</strong> to not
122+
query from database frequently. Assume that we have a Person entity
123+
like that:</p>
124+
<pre lang="cs">public class Person : Entity
125+
{
126+
public string Name { get; set; }
127+
128+
public int Age { get; set; }
129+
}</pre>
130+
<p>And assume that we frequently want to get <strong>Name</strong> of people while we know their
131+
<strong>Id</strong>.
132+
First, we should create a class to store <strong>cache items</strong>:</p>
133+
<pre lang="cs"><strong>[AutoMapFrom(typeof(Person))]</strong>
134+
public class PersonCacheItem
135+
{
136+
public string Name { get; set; }
137+
}
138+
</pre>
139+
<p>We <strong>should not directly store entities in the cache</strong> since
140+
caching may need to <strong>serialize</strong> cached objects and
141+
entities may not be serialized (especially if they have navigation
142+
properties). That's why we defined a simple class to store data in
143+
the cache. We added <strong>
144+
AutoMapFrom</strong> attribute since we want to use AutoMapper to
145+
convert Person entities to PersonCacheItem objects. If we don't use
146+
AutoMapper, we should <strong>override MapToCacheItem</strong>
147+
method of EntityCache class to manually convert/map it.</p>
148+
<p>While it's <strong>not required</strong>, we may want to define an interface for
149+
our cache class:</p>
150+
<pre lang="cs">public interface IPersonCache : <strong>IEntityCache&lt;PersonCacheItem&gt;</strong>
151+
{
152+
153+
}</pre>
154+
<p>Finally, we can create the cache class to cache Person entities:</p>
155+
<pre lang="cs">public class PersonCache : <strong>EntityCache&lt;Person, PersonCacheItem&gt;</strong>, IPersonCache, <strong>ITransientDependency</strong>
156+
{
157+
public PersonCache(ICacheManager cacheManager, IRepository&lt;Person&gt; repository)
158+
: base(cacheManager, repository)
159+
{
160+
161+
}
162+
}</pre>
163+
<p>That's all. Our person cache is ready to use. Cache class can be
164+
transient (as in this example) or singleton. This does not mean the
165+
cached data is transient. It's always cached globally and accessed
166+
thread-safe in your application.</p>
167+
<p>Now, whenever we
168+
need <strong>Name</strong> of a person, we can get it from cache by
169+
the person's
170+
<strong>Id</strong>. An example class that uses the Person cache:</p>
171+
<pre lang="cs">public class MyPersonService : ITransientDependency
172+
{
173+
private readonly IPersonCache _personCache;
174+
175+
public MyPersonService(<strong>IPersonCache personCache</strong>)
176+
{
177+
_personCache = personCache;
178+
}
179+
180+
public string GetPersonNameById(int id)
181+
{
182+
<strong>return _personCache[id].Name;</strong> //alternative: _personCache.Get(id).Name;
183+
}
184+
}</pre>
185+
<p>We simply <a href="Dependency-Injection.html">injected</a>
186+
IPersonCache, got the cache item and got the Name property.</p>
187+
<h4>How EntityCache Works</h4>
188+
<ul>
189+
<li>It gets entity from repository (from database) in first
190+
call. Then gets from cache in subsequent calls.</li>
191+
<li>It automatically invalidates cached entity if this entity is
192+
updated or deleted. Thus, it will be retrieved from database in
193+
the next call.</li>
194+
<li>It uses IObjectMapper to map entity to cache item.
195+
IObjectMapper is implemented by AutoMapper module. So, you need
196+
to
197+
<a href="/Pages/Documents/Data-Transfer-Objects#DocAutoMappingHelpers">
198+
AutoMapper module</a> if you are using it. You can override
199+
MapToCacheItem method to manually map entity to cache item.</li>
200+
<li>It uses cache class's FullName as cache name. You can change
201+
it by passing a cache name to the base constructor.</li>
202+
<li>It's thread-safe.</li>
203+
</ul>
204+
<p>If you need more complex caching requirements, you can extend
205+
EntityCache or create your own solution.</p>
117206
<h3>Redis Cache Integration</h3>
118207
<p>Default cache manager uses <strong>in-memory</strong> caches. So, it can be a
119208
problem if you have more than one concurrent web server running the

doc/WebSite/Documents.html

-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ <h3>ABP Framework</h3>
5555
<li>
5656
<a href="/Pages/Documents/OWIN">OWIN Integration</a>
5757
</li>
58-
<li>
59-
<a href="/Pages/Documents/Debugging">Debugging</a></li>
6058
</ul>
6159
</li>
6260
<li>Common Structures</li>

doc/WebSite/Setting-Management.html

+8-1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ <h3 id="DocDefiningSettings">Defining settings</h3>
9090
<li>
9191
<strong>IsVisibleToClients</strong>: Set true to make a setting usable
9292
on the client side.</li>
93+
<li>
94+
<strong>isInherited</strong>: Used to set if this setting is
95+
inherited by tenant and users (See setting scope section).</li>
96+
<li>
97+
<strong>customData</strong>: Can be used to set a custom
98+
data for this setting definition.</li>
9399
</ul>
94100
<p>After creating a setting provider, we should register it in PreIntialize
95101
method of our module:</p>
@@ -117,7 +123,8 @@ <h4 id="DocSettingScopes">Setting scope</h4>
117123
</ul>
118124
<p>SettingScopes enum has <strong>Flags </strong>attribute, so we can define a
119125
setting with <strong>more than one scopes</strong>.</p>
120-
<p>Setting scope is <strong>hierarchic</strong>. For example, if we define a
126+
<p>Setting scope is <strong>hierarchic</strong> by default (unless
127+
you set <strong>isInherited</strong> to false). For example, if we define a
121128
setting's scope as "Application | Tenant | User" and try to get <strong>current value
122129
</strong>of the the
123130
setting;</p>

global.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"projects": [ "src", "test" ],
3+
"sdk": {
4+
"version": "1.0.0-preview1-002702"
5+
}
6+
}

nupkg/README.md

-1
This file was deleted.

nupkg/pack.bat

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
REM "..\tools\gitlink\GitLink.exe" ..\ -u https://github.com/aspnetboilerplate/aspnetboilerplate -c release
2+
3+
@ECHO OFF
4+
SET /P VERSION_SUFFIX=Please enter version-suffix (can be left empty):
5+
6+
dotnet "pack" "..\src\Abp" -c "Release" -o "." --version-suffix "%VERSION_SUFFIX%"
7+
dotnet "pack" "..\src\Abp.AutoMapper" -c "Release" -o "." --version-suffix "%VERSION_SUFFIX%"
8+
dotnet "pack" "..\src\Abp.HangFire" -c "Release" -o "." --version-suffix "%VERSION_SUFFIX%"
9+
dotnet "pack" "..\src\Abp.EntityFramework" -c "Release" -o "." --version-suffix "%VERSION_SUFFIX%"
10+
dotnet "pack" "..\src\Abp.FluentMigrator" -c "Release" -o "." --version-suffix "%VERSION_SUFFIX%"
11+
dotnet "pack" "..\src\Abp.MemoryDb" -c "Release" -o "." --version-suffix "%VERSION_SUFFIX%"
12+
dotnet "pack" "..\src\Abp.MongoDB" -c "Release" -o "." --version-suffix "%VERSION_SUFFIX%"
13+
dotnet "pack" "..\src\Abp.NHibernate" -c "Release" -o "." --version-suffix "%VERSION_SUFFIX%"
14+
dotnet "pack" "..\src\Abp.RedisCache" -c "Release" -o "." --version-suffix "%VERSION_SUFFIX%"
15+
dotnet "pack" "..\src\Abp.Owin" -c "Release" -o "." --version-suffix "%VERSION_SUFFIX%"
16+
dotnet "pack" "..\src\Abp.Web" -c "Release" -o "." --version-suffix "%VERSION_SUFFIX%"
17+
dotnet "pack" "..\src\Abp.Web.Api" -c "Release" -o "." --version-suffix "%VERSION_SUFFIX%"
18+
dotnet "pack" "..\src\Abp.Web.Mvc" -c "Release" -o "." --version-suffix "%VERSION_SUFFIX%"
19+
dotnet "pack" "..\src\Abp.Web.SignalR" -c "Release" -o "." --version-suffix "%VERSION_SUFFIX%"
20+
dotnet "pack" "..\src\Abp.Web.Api.OData" -c "Release" -o "." --version-suffix "%VERSION_SUFFIX%"
21+
dotnet "pack" "..\src\Abp.TestBase" -c "Release" -o "." --version-suffix "%VERSION_SUFFIX%"
22+
dotnet "pack" "..\src\Abp.Web.Resources" -c "Release" -o "." --version-suffix "%VERSION_SUFFIX%"
23+
24+
pause

nupkg/pack_abp.bat

-43
This file was deleted.

src/.nuget/NuGet.Config

-6
This file was deleted.

src/.nuget/NuGet.exe

-1.58 MB
Binary file not shown.

0 commit comments

Comments
 (0)