Tuesday, August 31, 2010

All Male Spa Nj Star Spa

As the storm.

As the storm going. Last dose of news at the end of vacation. Now I probably will not be enough time .. : /
The first one announced with our small child in LO. :)
Ideally, of course, gave the studs with scrap.com.pl ;)






Roses made based on the rate of scrappassion Sassili.


And this is my favorite;)

Today I finished the piece dress.






Again, rubella:)


Haha, yesterday out of boredom oskrapowałam even my cork board: DD


And tomorrow ..


pile of books and notebooks and now is, krowiasty pencil case too: D
A Polish my book subtitled 'scrapmania' oO

I hit my:



And so I conclude. But I hope that soon I will write here.
: *


Sunday, August 29, 2010

Wording For Retirement Cakes

QueenEfekt went

Although the remaining two hours yet to officially launch ... but I can confidently say that the community information service for fans of the band Queen is already running.

Almost all of the information in one place, news and articles on an ongoing basis and the community, friends ...

From the biography, by concerts, to the gadgets. Accurate descriptions, photos, videos, texts, translations, albums, songs, awards, tour, discography and even a dictionary. Support for search and calendar.

All you can comment, rate and edit.

The mini-blog community, friends, news, galleries and information.

whole summarizes innovative online radio - Radio Gaga - Queen where the game without interruption.

Anything else?
much, much more ... lots of information, contact with fans and friends, great fun.

Join http://QueenEfekt.pl

Tuesday, August 24, 2010

Spanish Wording For Receptions

Nhibernate - the relationship one to many and a few cosmetic changes

Hi after quite a long break due to the holidays:) Today I decided a little bit to describe a very simplified model of the logic associated closely with the forum or entities, such as Category Forum, Forum, Topic, Post. In addition, describe a few cosmetic.


logic associated with the forum

Forum will consist of categories. They divide the whole forum partly related to each other thematically. Each categories can have multiple forums. The forums have included topics and have many posts. Currently, models are very simple. With the development of the project and increasing functionality will grow
Forum Categories Class: public class
ForumCategory: BaseEntity
public virtual IEnumerable {get \u0026lt;Forum> Forums ; set;}}
Class Forum:

public class Forum: BaseEntity
 {public virtual string Name {get; set;  } 

public virtual string Description { get; set; }

public virtual ForumCategory Category { get; set; }

public virtual IEnumerable<Topic> Topics { get; set; }
}
 Klasa Temat: 

public class Topic : BaseEntity
{
public virtual string Name { get; set; }

public virtual Forum Forum { get; set; }

public virtual IEnumerable<Post> Posts { get; set; }
}
Klasa Post:
 public class Post : BaseEntity 
{
public virtual string Name { get; set; }
Public virtual
Topic Topic {get; set;}}



Nhibernate - one to many relationships

As seen above in our simple model of entity pair relations: one to many. The Fluent Nhibernate maps these relationships by the method of References and hasMany. Re is the same as the method that the entity that is Hason has an object in a relationship. However hasMany means that the entity has a number of objects from a given relation. The combination of these two methods gives rise to many a relationship. Now a simple example, mapping one to many relationship: ForumCategory -> Forum
 
public class ForumCategoryMap: ClassMap \u0026lt;ForumCategory>
{
Public ForumCategoryMap () {

Id (p => p.Id). GeneratedBy.Guid ();
Map (p => p.Name). Not.Nullable (.) Length (256 ); hasMany (p => p.Forums);

}}
 
And here we have the other end of our relationship that is a class forum: public class

ForumMap: ClassMap \u0026lt;Forum>
{
public ForumMap () {

Id (p => p.Id). GeneratedBy.Guid ();

Map (p => p.Name). Not.Nullable (). Length ( 256);
Map (p => p.Description). Not.Nullable (.) Length (256);
References (p => p.Category);
hasMany (p => p.Topics);
}} 


As can be seen in a very simple manner by means of Fluent Nhibernate we can create one to many relationships.

In addition to these changes I introduced the basic layout of the forum. Removed commandy. Their roles now Przejma DataTransferObjecty. Podmieniłem client-side validation of the standard Microsoft on jQuery. This required a download MVC Futures and substitution in views instead MicrosoftMvcValidation.js MicrosoftMvcJQueryValidation.js file.


Friday, August 13, 2010

Intermittent Ea Fault On

Resources (Resources) - that is multilingual

Today short entry about the multilingual pages. I will be based on the files. Resx. The mechanism is built into the same platform, but the net will describe how and what solved in practice.


ResourceHelper

It is our object is to facilitate the collection of auxiliary files. Resx. It is also responsible for initialization of ResourceManager that is the main subject of the page. NET that allows you to manage resources. Class itself is not complicated. In addition to the init method has only one method that takes a string value from our resource files. Class it looks like this: public static
ResourceHelper class
{private static ResourceManager public static void Initialize (ResourceManager ResourceManager)
{
Check.Argument.IsNotNull (ResourceManager, "ResourceManager"); _resourceManager = ResourceManager;

} public static string GetErrorMessage (string key) {

string errorMessage = _resourceManager.GetString (key);

if (errorMessage == null) throw new ArgumentException
(_resourceManager.GetString (ResourceKey.Common.InvalidMessage));

return errorMessage;}


class itself is static. As you can see here there is also a class named ResourceKey. This class has all the information about the names of the variables in the files. Resx. I just do not have to always enter a string, just use an auxiliary class and in case of a change in only one place it will be necessary. Such a little easier:) In addition to the projections of newly added files. Resx is also a factory which generates all the appropriate ResourceManager which subsequently initiate our helper. It looks very simple: public class

ResourceManagerFactory: IResourceManagerFactory
{private ResourceManager
_resourceManager;

public ResourceManagerFactory ()
} {


CreateResourceManager public ResourceManager ()
 {if (null == _resourceManager) 
_resourceManager = new ResourceManager ("mForum.Resources.ErrorsAndExceptions.ErrorMessages" Assembly.GetExecutingAssembly ());

_resourceManager return;

}}

Sam ResourceManager constructor takes two arguments. 1 is the name of the class that was generated with the creation of a file. Resx. The second is a library which is located in the file.

contrast in views have accepted a little different approach when it comes to resources. Resources standardly that is internal are only available from the library but for me all the resources associated with the presentation layer will cause the public to what we can directly refer to the file. resx with our views.

In addition to these changes, of course, I added tests related to our ResourceHelperem.


Wednesday, August 11, 2010

Men's Full Elastic Waist Jeans

the Event Aggregator - What is this?

Today I would like to describe another pattern / mechanism that I will be using, and it aims to significantly simplify the code and eliminate unnecessary relationships between objects.


Event Aggregator
As mentioned earlier, this pattern / mechanism is intended to eliminate unnecessary relationships between objects. It provides a single source for multiple objects. In its simplest form it looks like the class so that the record which relate to a specific event to our event aggregator. These classes are called handles (handlers). However, when we send an event to the event aggregator, it selects all the fixtures which relate to an event, sends them to an event, and they no longer deal with the perception of these events and activities related shares. In my forum I will use a fairly simple solution because it does not need anything complicated. An event is just a simple object which must implement the interface IEvent. eg
Public class
UserCreatedEvent: IEvent {}
EventAggregator: IEventAggregator
{private readonly
SynchronizationContext _context; private readonly IListenerService _listenerService;
public EventAggregator (context SynchronizationContext , IListenerService listenerService)
{
 Check.Argument.IsNotNull (context, "context"); 
Check.Argument.IsNotNull (listenerService, "listenerService");

_context = context;
 _listenerService = listenerService; 
}

public void SendMessage<T>(T message) where T : IEvent
{
var listeners = _listenerService.GetListeners<T>();

SendAction(() => listeners.ForEach(x => SendMessageToListeners<T>(x, message)));
}

private void SendMessageToListeners<T>(IListenTo<T> x, T message) where T : IEvent
{
x.Handle(message);
}

private void SendAction(Action action)
{
_context.Send (state => action (), null);}

}

heart of the whole event aggregator function is SendMessageToListeners. This function is responsible for sending events to the recipients. All brackets (handlers) are recorded IoC container FOR IN. However ListenerService just takes all those that apply to this event. Then, using the event aggregator lambda been specifically send events to a specific fixture. Everything is of course wątkowo-safe (thread-safe). In the event that was to be an asynchronous call. It sounds terrible in Polish: P Event handler that is nothing but a class that implements intertejs IListenTo that looks like this: public interface

IListenTo \u0026lt;T> WHERE T: IEvent

{void Handle (T message);}


This is a normal class with a method that has a Handle on the event argument.

And now a practical example. Say to create a new user. With the creation of entails, giving him the basic rights, sending an email confirming his / her e-mail address. In the normal case, simply a method of forming wywołalibyśmy methods from other classes associated with these activities. That is: public void
CreateUser () {
 / / here share associated with the addition of 
's ...

_rolesService.AddRole ();
_emailService.SendEmail ();}


unnecessary connections are formed with various objects. In the event of any modification services related roles, or sending e-mails it is possible that it will be a need for change in many places in the code. In small systems, it is not a problem but if grown in a difficult work, upgrading the application. It solved the same task with our Event Handler. We CreatedUserEvent event.
 / / here we have a separate class is not related at all with the method CreateUser 
class VerificationEmailHandler: IListenTo \u0026lt;CreatedUserEvent> {};
class BasicRoleHandler: IListenTo \u0026lt;CreatedUserEvent> {};
//----------------------------- ---------------------------
CreateUser public void () {

/ / here share for adding user
...
CreatedUserEvent CreatedUserEvent event = new ();
_eventAggregator.SendMessage (testEvent);}
 

Immediately I can see the removed redundant links between the objects. Method CreatedUser have no idea about the other services (servicow) non-specifically with it. In addition, the code can easily expand with new fixtures, where appropriate, as simply register a new handle, and it will be executed. You do not need any code changes.

Apart from the Event Handler, of course, I added a test associated with it. Thus created a new test project associated with mForum.Core. That's all for today:)


Tuesday, August 10, 2010

Diagram Of A Theme Park

Infrastructure related closely with Asp.net MVC ...

Now the time has come for the basic infrastructure for Asp.net MVC. So, among other things: ViewData Model, Commands, adapting to the new views structure. In addition, I will discuss briefly automappera.


ViewData Model

What a monster of many probably will ask. These are the models (classes) used to transmit data from the controller to the view. Thanks to him views may be strongly typed to a particular model. We can thus avoid the use of ViewData and we have all the data from the view nicely in a single model. This greatly facilitates access to data. I will not elaborate too much on this subject but significantly expanded explanation can be found on this blog


BaseViewData
{public string Sitetitle {get; set;}
public string PageTitle {get; set;} public string MetaKeywords {get; set;} public string

MetaDescription {get; set;}}

 Then is a concrete example, the controller for ViewDataModel AccountViewData which is in the constructor sets the page title. Sample Implementation Account for the controller: public class 

AccountViewData: BaseViewData
{private string
_pageTitle = "Account";

public AccountViewData () {

PageTitle = _pageTitle;

}} And then

have very definite views of models that inherit from the model controller for example: public class
 
LogOnViewData: AccountViewData
{
[Required]
[DisplayName ("User name")] public string
UserName {get; set;}

[Required ]
[DataType (DataType.Password)]
[DisplayName ("Password")] public string
Password {get; set;}
 [DisplayName ("Remember me?")] public bool 
rememberMe {get; set;
}}

ViewData generation of models is done using the factory so that a particular controller does not have to know a variable with Site.Mastera. Examples of the creation of a model for the controller ViewData Account Login View Public ActionResult

Logon () {

LogOnViewData _viewDataFactory.Create \u0026lt;LogOnViewData> view = ();

return View (view);}



Commands
 Next item associated with the views of the commandy. They are used to bound with BIA data that form to send us a specific controller. This allows us to write a public 

ActionResult Register (RegisterCommnad command)

instead: public

ActionResult Register (FormCollection formitems)

and draw from this field.
Automapper
 Automapper is a small library to facilitate the mapping of object to another object. This is useful mainly in the transformation of the entity at the DTI. The same map after setting looks like this: 
testuser User testuser = new ();
UserDTO testUserDTO = Mapper.Map \u0026lt;User, UserDTO> (testuser);
 
As you can see nice, easy and fun. Now a few words about the configuration. Let's start by creating a profile that is the class who has information on how to map the objects. It looks like this: public class

DefaultProfile: Profiles
{public override string ProfileName
{get {
 return "DefaultProfile" 

}}

protected override void Configure () {
 
/ / configure here
types / / Example of the User UserDTO
Mapper.CreateMap \u0026lt;User, UserDTO & # 62; ()
. ForMember (dest => dest.Id, opt => opt.MapFrom (src => src.Id))
/ / gave only the first field analogy, but the rest

}}

Then we create a Bootstrapper task that will be it for us at the beginning of configurations wczytywał: public class

AutoMapperConfiguratorTask : BootstrapperTask
{protected override
TaskContinuation ExecuteCore (IServiceLocator serviceLocator)
{
Mapper.Initialize (x => x.AddProfile \u0026lt;DefaultProfile> ());

TaskContinuation.Continue return;}

}

 I already have configured automappera. This is a very useful library for easy lives. In addition to these major changes as described in the alert. I added a simple service associated with the user and accordingly modified the controllers and views. So I have a simple login working. 


Sunday, August 8, 2010

Maybelline Dream Blush Peach Satin Swatch

Asp.net MVC - IoC and Bootstrapper. Introduction to Library

Then the interface database I decided to get on the Bootstrapper and implement IoC container. Tell a little bit here about the MVC pattern of DI and by way of introduction


dependancy injection and Inversion of Control (IoC)

dependancy injection (injecting dependencies) design pattern is that of eliminating the direct dependence between the components for a plugin architecture. In practice, it looks like the interface is used instead of concrete classes which makes them can easily be around with. Through this technique, we can create easily testable objects.

Asp.net MVC
Model: It is a component that consists of business objects (entities) as well as business logic. Generally, this part is responsible for drawing and storing data in a database.
View: Views are components that display the user interface. After appropriate processing the object code is the html code (for web applications) and other associated technologies. Typically, views are generated in the leaning data model.
Controller: Controllers are designed to handle interactions with, work with the data model view and choose which display in May.

For more information, see the page I recommend Asp.net MVC. After a brief introduction, we can return to the main topic.


Bootstrapper

What is this Bootstraper probably ask. It is an object that is executed at the beginning of the web application. Aims to create basic configurations and perform tasks that are necessary before the application can be run IoC container such as registration, routing configuration, adding his own factory inspectors. Well, I mentioned in the title collection of MVC Extensions much to facilitate this action because the majority is already in less concluded. Let's start from the beginning. The first step is to replace the HttpApplication object from the Global.asax with the appropriate library MVC Extensions. In my case, it will be because I use UnityMvcApplication Unity container. Global.asax will now look like this: public class

MvcApplication: UnityMvcApplication
} {

As you can see nothing special. But what makes me like we will not have to manually create UnityControllerFactory which is necessary for our application is running with this container. Also, this class will perform basic tasks associated with Asp.net MVC as well as their own which we can implement. In addition, we add an object that implements the interface IModule. It will be used to configure the IoC container. Public class
RegisterServices: IModule
{public void Load (IUnityContainer container)
 {/ / here you configure the container. Add the repositories, services. 

}}


Bootstrapper Tasks
 
first task that is associated directly with Asp.net MVC is a class which we will set up your routing. It must inherit from class RegisterRoutesBase. Sample implementation: public class

RegisterRoutes: RegisterRoutesBase

{protected override void Register (RouteCollection routes)

{/ / here we routing configuration in August.

}} Another interesting task but not required is a class that allows us to filter the global configuration. In short, allow us to inject dependencies to filter because normally there is no way to do it. About specific solutions and examples I'll write later. Sample implementation: public class

RegisterGlobalFilters: ConfigureFiltersBase
 
{protected override void Configure (IFilterRegistry registry)

{/ / here we register the global filters
registry.Register \u0026lt;HomeController, MyCustomAttribute> ();}

}
In addition to these specific tasks that must be performed before an application can define your own. These objects must inherit from BootstrapperTask. For me that would like to initiate IoC container class that provides the application: public class
 RegisterIoC: BootstrapperTask 
{protected override
TaskContinuation ExecuteCore (IServiceLocator serviceLocator)
{
IoC.InitializeWith (serviceLocator);

TaskContinuation.Continue return;}

}

incomprehensible element can only be here for the return type TaskContinuation. It can take three values: Continue, Skip, and Break. Continue will perform the following tasks in order of normal, Skip causes bypass of the one of the tasks of the Break will cease to hold the next task.
 
As you can see a collection of MVC Extensions life easier for us because it has many interesting solutions. I highly recommend you read this. In addition, many solutions of these libraries will be seen in Asp.net 3.0 MVC


How To Use Ubuntu For Runescape Botting

MVC Extensions interface for accessing a database sequence continued ...

As mentioned earlier the next step in the implementation of the interface associated with the database repository will be essential. It will have a common part of all the repositories. So, for example, CRUD operations (insert, add, delete, modify), get the id and return items in a given period (paging elements). This is the implementation of this class: public class

BaseRepository \u0026lt;TEntity>: IRepository \u0026lt;TEntity>, IDisposable TEntity WHERE: class, IEntity
{
private DatabaseContext _databaseContext;
public BaseRepository(IDatabaseFactory databaseFactory)
{
Check.Argument.IsNotNull(databaseFactory, "databaseFactory"); }
     protected IDatabaseFactory DatabaseFactory 
{
get;
private set;
}

protected DatabaseContext DatabaseContext
{
get
{
return _databaseContext ?? (_databaseContext = DatabaseFactory.Get());
}
}

public void Dispose()
{
if (DatabaseContext != null)
GC.SuppressFinalize(DatabaseContext);

if (DatabaseFactory != null)
GC.SuppressFinalize(DatabaseFactory);
}

public IEnumerable<TEntity> GetBySpec(ISpecification<TEntity> specification)
{
Check.Argument.IsNotNull(specification, "specification");

IEnumerable<TEntity> result = DatabaseContext.CreateQuery<TEntity>().Where(specification.SatisfiedBy());

return result;
}

public virtual void Add(TEntity entity)
{
Check.Argument.IsNotNull(entity, "entity");

DatabaseContext.Save<TEntity>(entity);
}

public virtual void Delete(Guid id)
{
Check.Argument.IsNotNull(id, "id");

TEntity entity = GetById(id);

if (entity != null)
DatabaseContext.Delete<TEntity>(entity);
}

public virtual void Delete(TEntity entity)
{
Check.Argument.IsNotNull(entity, "entity");

DatabaseContext.Delete<TEntity>(entity);
}

public virtual TEntity GetById(Guid id)
{
return DatabaseContext.CreateQuery<TEntity>().SingleOrDefault<TEntity>(x => x.Id == id);
}

public virtual IEnumerable<TEntity> All()
{
return DatabaseContext.CreateQuery<TEntity>();
}

public IEnumerable<TEntity> GetPagedElements<S>(int pageIndex, int pageSize, Expression<Func<TEntity, S>> orderExpression, bool ascending)
{
Check.Argument.IsNotNegativeOrZero(pageIndex, "pageIndex");
Check.Argument.IsNotNegative(pageSize, "pageSize");
Check.Argument.IsNotNull(orderExpression, "orderExpression");

IQueryable<TEntity> objectQuery = DatabaseContext.CreateQuery<TEntity>();

return (ascending) ? objectQuery.OrderBy(orderExpression)
.Skip((pageIndex - 1) * pageSize)
.Take(pageSize)
.ToList()

: objectQuery.OrderByDescending(orderExpression)
.Skip((pageIndex - 1) * pageSize)
.Take(pageSize)
.ToList();

}

public IEnumerable<TEntity> GetPagedElements<S>(int pageIndex, int pageSize, Expression<Func<TEntity, S>> orderExpression, ISpecification<TEntity> specification, bool ascending)
{
Check.Argument.IsNotNegativeOrZero(pageIndex, "pageIndex");
Check.Argument.IsNotNegative(pageSize, "pageSize");
Check.Argument.IsNotNull(orderExpression, "orderExpression");
Check.Argument.IsNotNull(specification, "specification");

IQueryable<TEntity> objectQuery = DatabaseContext.CreateQuery<TEntity>();

return (ascending) ? objectQuery.Where(specification.SatisfiedBy())
.OrderBy(orderExpression)
.Skip((pageIndex - 1) * pageSize)
.Take(pageSize)
. ToList ()

: objectQuery.Where (specification.SatisfiedBy ())
. OrderByDescending (orderExpression)
. Skip ((PageIndex - 1) * pageSize)
. Take (pageSize)
. ToList ();}


}

As you can see most of the methods here are simple operations on a database using LINQ.
Besides this is the method by means of a previously mentioned specifications pulls data from the database. Now the example of a simple repository of user: public class

UserRepository: BaseRepository \u0026lt;user>, IUserRepository
{
public UserRepository(IDatabaseFactory dbFactory)
: base(dbFactory)
{

}
public int CountAllUsers()
{
return DatabaseContext.Users.Count();
     } 

public int CountNumberOfOnlineUsers()
{
UserOnlineUsersSpecification specification = new UserOnlineUsersSpecification();

return this.GetBySpec(specification).Count<User>();
}

public IEnumerable<User> GetAllUsersOnline()
{
UserOnlineUsersSpecification specification = new UserOnlineUsersSpecification();

return this.GetBySpec(specification);
}

public User FindUserByUsername(string username)
{
Check.Argument.IsNotEmpty(username, "username");

UserUsernameSpecification specification = new UserUsernameSpecification(username);

return this.GetBySpec(specification).SingleOrDefault<User>();
}


public User FindUserByEmail(string email)
{
Check.Argument.IsNotEmpty(email, "email");
Check.Argument.IsNotInvalidEmail(email, "email");

UserEmailSpecification specification = new UserEmailSpecification (email);

return this.GetBySpec (specification). SingleOrDefault \u0026lt;user> ();}



} In this example, we can already see the use of these mysterious specifications. As you can see this solution is quite nice presents and separates the logic from the database itself. In addition, they can be re-used in different places of our repository. I added three types of specifications for a project associated with the user. So one can also see. This repository is using them.

In fact, the entire interface to the database already is almost ready. There are possibly a small patch. The project NHibernate tests added tests related to the classes above.


Saturday, August 7, 2010

Can Any One Share Yamaha Psr Indian Style

NHibernate 3.0 and FluentNHibernate first steps and first problems ... Interface Design

Since I decided to use my application to NHibernate 3.0, consequently, also wanted to be able to use FluentNhibernate. And there appeared a little problem. Since the authors do not officially support the new version of NHibernate yet because it is alpha. But when I wanted to use the current version is throwing errors on the version of the library he is not responding. Poszperałem a little on the internet and found solution. Well, just download the source FluentNHibernate, then in that project to replace the old library to new with NHibernate 3.0. Then build and everything works.

As already solved the problem I posted earlier basic classes of service database, such as DatabaseContext and DatabaseFactory. The investments were largely modeled on the CodePlex project shrinkr.


Database Context
DatabaseContext contains basic methods such as saving, deleting objects from the database, approving amendments. Public class
ISession _session;
private ITransaction _transaction;

private IQueryable<User> _users;
public DatabaseContext(ISession session) {
Check.Argument.IsNotNull(session, "session");
         _session = session; 
}

public IQueryable<User> Users
{
[DebuggerStepThrough]
get
{
return _users ?? (_users = CreateQuery<User>());
}
}

public virtual IQueryable<TEntity> CreateQuery<TEntity>() where TEntity : class, IEntity
{
return _session.Query<TEntity>();
}

public virtual TEntity GetById<TEntity>(long id) where TEntity : class, IEntity
{
Check.Argument.IsNotNegative(id, "id");
return _session.Get<TEntity>(id);
}

public virtual void Save<TEntity>(TEntity entity) where TEntity : class, IEntity
{
Check.Argument.IsNotNull(entity, "entity");
EnsureTransaction();
_session.SaveOrUpdate(entity);
}

public virtual void Delete<TEntity>(TEntity entity) where TEntity : class, IEntity
{
Check.Argument.IsNotNull(entity, "entity");
EnsureTransaction();
_session.Delete(entity);
}

public virtual void Commit()
{
EnsureTransaction();
_transaction.Commit();
}

private void EnsureTransaction()
{
if (_transaction == null
{
_transaction _session.BeginTransaction = ();

}}}





Database Factory

DatabaseFactory contrast is the main object associated with the management of the database because it is the whole configuration Nhibernate using the previously mentioned syntax Fluent . It is located in a private method, but I will not show it here. The interface of this class has only one method by means of which we can get DatabaseContext. Public interface

IDatabaseFactory

DatabaseContext {Get ();}


Unit of Work
last object associated with the database which is now added UnitOfWork. Since most operations on the data held by the transaction. We must have an object that allows us to approve the changes. When it is this objective has been created. The interface looks like this: public interface
 IUnitOfWork 

{void Commit ();}

implementations of the same class after invite to the sources.
Oh, and even added to the walkthrough test project associated with Nhibernatem. That's all for today. In the next post will be a little bit about how to implement the underlying repositories and probably Pre Implementation repository user.

My Leopard Gecko Wont Eat Anything

connected with the database.

Today we will be designing the basic interface of the business logic and database. Among other things, implementation of the entity, the interface repository.
 

Entities

Let's start with the creation of an entity. For the purpose of building the application architecture so far only a creature entities. It will be you. Let's start by implementing an interface entity. Part of it is common for each entity id. So, our interface will have just the box.

public interface IEntity

To help realize we create The base entities which will be implemented the above interface. This we do not have to write in each entity id field. In the event that there are other fields that will be shared as easily, you can modify the underlying entities, which will affect all entities have.
's implementation of core entities: public abstract class BaseEntity: IEntity
{public virtual Guid
Id {get; set;}}
 


As I have the basic types from which they will inherit our entities, we can now implement the first of them:
public class User: BaseEntity, IEntity
{
public virtual string Username { get; set; }
  
public virtual string Password { get; set; }

public virtual string Email { get; set; }
public virtual string PasswordQuestion { get; set; }

public virtual string PasswordAnswer { get; set; }
  
public virtual bool isLockedOut { get; set; }

public virtual DateTime LastActivityDate { get; set; }

public virtual DateTime LastLoginDate { get; set; }

public virtual DateTime LastLockedOutDate { get; set; }

public virtual DateTime CreatedDate { get; set; }

}



Repositories

Then I would like to say something about the objects that can be found in my project. These are the repositories. The repository is a class that directly have access to the database. It provides basic CRUD and other directly related to the entity. Mediates between the base and the services which these data will be needed. This allows the decoupling of the project on a specific ORM-a. Substitution requires only implement the context database and the various repositories. Implementation of the interface repository looks like this: public interface

IRepository \u0026lt;TEntity> where TEntity : class
{
TEntity GetById(Guid id);
IEnumerable<TEntity> GetBySpec(ISpecification<TEntity> spec);
void Add(TEntity entity);
void Delete(Guid id);
void Delete(TEntity entity); IEnumerable<TEntity> GetPagedElements<S>(int pageIndex, int pageSize, Expression<Func<TEntity, S>> orderExpression, bool ascending); IEnumerable<TEntity> GetPagedElements<S>(int pageIndex, int pageSize, Expression<Func<TEntity, S>> orderExpression, ISpecification \u0026lt;TEntity> specification, bool ascending);
IEnumerable \u0026lt;TEntity> All ();}
 
Most of the features here is quite understandable. The only puzzle is possible to be ISpecifcation interface. Look at the example implementations: public class

UserOnlineUsersSpecification: Specification \u0026lt;user>
{private DateTime
_onlineTime;

public UserOnlineUsersSpecification () {


}
public override Expression \u0026lt;Func \u0026lt;User , bool>> SatisfiedBy () {
 _onlineTime = DateTime.Now.AddMinutes (-5); 

return x => x.LastActivityDate> = _onlineTime;
}}


This specification is intended to refer lamba expression that will allow us to find the currently registered users online. How widzymy every specification consists SatisfiedBy method that returns the lamba expression. This expression is used in the database to retrieve the data. In short this is a small part of the business logic wrapped in a class which makes it can be used in many places and avoid repetition in the code. More on this pattern can be found on Wikipedia



In the following we will deal with entries already concrete implementation classes associated with NHibernate and the database.


Friday, August 6, 2010

Relieve Endometriosis Bloating

project and the basic structure of helpers and extensions.

In this post I will try to bring home the project structure as well as to describe the basic helpers and extensions that I use most of my projects.


Project Structure: - mForum.Core
- Here you will find all the class / structure / methods that are common to the entire walkthrough and be used in each project.
- -
mForum.Infrasturcture.Automapper
- This project will need to initialize the class library AutoMapper - mForum.Infrastructure.NHibernate
- Here znowuż find everything related to the mapping data and base. So implementations of repositories, objects, initiating database. - mForum.Services
- This is an intermediary layer between business logic and presentation layer which is Asp.net MVC in this project. You will find here mostly all the classes, methods that are mediated the circulation of data between the business logic layer and presentation layer. - mForum.Web
- Here we have the presentation layer. In this project we will find views, scripts, js, css templates. In general, everything related to web design from the graphic. - mForum.Web.Common
- This is a project in which objects are directly related to the presentation layer from the developer. Here, we will be able to find their own attributes, MVC controllers, the tasks to be performed just prior to application (called Bootstrapper Taski). As I mentioned earlier have already added the class / method that I usually use in each project, such universal support class work.
The first of these is a class check. This class has methods sprawdzajace The input data and in case the condition of inconsistency in the method throws an appropriate exception. A simple example of checking whether the inputs are not null: testMethod void (object testProperty)
{if (testProperty == null) throw new ArgumentException (testProperty can not be null ");
... }
In the case of a single argument that is not too onerous and in larger quantities can cause a slight accumulation of conditional statements. This is solved by the same class Check:

testMethod void (object testProperty)
{
 Check.Argument.IsNotNull (testProperty, "testProperty"); 
...
}

Check class has many more methods for validation of input data. Once more I invite you to familiarize yourself with the code.

addition, I added a couple of extension methods for classes:
-
 DateTime: a method of verifying the correctness of the dates. Check class directly using these methods. 
-
String
: methods such as validation of the string as a url or e-mail address. Check the class uses them.
-
IEnumerable
: I added the extension that allows you to execute a line of code iterates through all elements of the collection and enforcement of any action on them. Foreach loop in condensed form.

That's it for today. Here comes the weekend so you can probably expect more entries. Oh and one more thing I have published a project on CodePlex so now everyone will have access to it. It is true that much still there but hey:)

Wednesday, August 4, 2010

Tech Deck Online Compotition

few words about the planning application and the selected technologies.

I mentioned earlier I made an extensive forum system. One might ask why it was just a forum when it is full of them? Mainly because they already quite a long time I had planned to write just such a project, but somehow I could not get together and start writing. The contest was just such an impulse to start.
main environment in which I wrote:
- Visual Web Developer 2010 Express - Microsoft Sql Server 2008 Express

Another thing I wanted to mention a few words about the chosen technology for this project :
-
ASP.NET MVC 2: Here the case was fairly simple because I decided to write this project . NET is I had to choose ASP.NET WebForms and MVC's. I personally will never accounted for my taste style and WebForms programming. Many of the problems caused for example the absence of a direct impact on the generated code, not very possibility of design patterns which resulted in more difficult applications testing. -
NHibernate
: Now to the issue of ORM-s. I took into account two NHibernate and the Entity Framework. After a careful analysis of their capabilities and how to create projects in it I think the Entity Framework, NHibernate can not be matched in the current version. However, recently started to appear in the CTP versions of the EF-a the so-called Code-First I must admit to going to be pretty good. Possible with future versions of NHibernate far short. The only problem Nhibernate LINQ provider is weaker than in the EF but I'm going to use for this project Nhibernate alpha version which was released recently. This should be corrected. It will be what to test:)
-
Automapper : Here is silent as to discuss. Nothing is more programmer's life easier as automatic mapping of objects such as the DTO to Domain Objects. For this purpose, is precisely the collection. - Microsoft Unity Container

: As my IoC container chose Unity. Mainly due to the relatively I use it a long time now and if I like the way it is setup and ease of use. -
MVC Extensions: In this library there is a lot of useful tools that can help / assistance in the design of applications such as Bootstrapping, Global filters, etc.. More on this subject I will probably describe the design-time application. This list may grow steadily as the project develops. For now, that's it. In the next post I will try to now bring the overall structure of the project and officially published sources (for now mostly empty:)) on CodePlex.
Welcome to the blog

Tuesday, August 3, 2010

How To Make Block Diagram Laser

Slowly begin ...

programming project for the contest, "Give to know" by Maciej Ansierowicza. For more information, refer to the page
contest
This blog will contain actions related to the development of the project "mForum. This project is an extended system forumowego. It will be written in C # using Asp.net MVC. So much with regard to the first entry. In a few days for good I will try to begin work on the project:)