بایگانی برچسب: Castle ActiveRecord

‫‫استفاده از Castle ActiveRecord در چند گام

Castle ActiveRecord یک ابزار کمکی برای استفاده راحت‌تر از NHibernate است. NHibernate خودش هم یک ORM کد باز دات‌نتی معروف است. در واقع می‌توان Castle ActiveRecord را یک ORM خیلی راحت دانست. بسیاری افراد فکر می‌کنند استفاده از ORMها و تنظیمات آنها کار خیلی سختی است. اما من در اینجا می‌خواهم در چند قدم ساده …

SchemaUpdate generates duplicate foreign keys

We have a typical web application that its data access layer is written using Castle ActiveRecord. Castle ActiveRecord exposes NHibernate’s SchemUpdate feature. This feature lets us to upgrade schema/database with current changes in domain entities. One odd problem with SchemaUpdate was that in many cases it was generating foreign keys again without any change in …

Update Schema in Castle ActiveRecord

NHibernate has a feature named “Schema Update”. This feature help updating schema of existing database based on new changes in mapping files. Schema update do not change current data, just changes schema (table, view, … structure) in an additive manner. Castle ActiveRecord exposes this feature too. The problem is with NHibernate you have choice for …

‫رکورد اضافی در NHibernate

من مشکلی با NHibernate دارم که نمی‌دانم آیا بقیه هم این مشکل را با NHibernate یا دیگر ORMها یا حتی ADO دارند یا نه. البته اصل این مشکل در صفحات ASP.NET Webform وجود دارد. مشکل این است که وقتی می‌خواهم یک آیتم را در دیتابیس ذخیره کنم یا حتی وقتی می‌خواهم یک رکورد را روی …

‫استفاده از سورس‌های Online

گاهی اوقات که می‌خواهیم روش استفاده از فلان متود یا کلاس یک Library خاص را دانسته یا می‌خواهیم چند نمونه کد با آن پیدا کنیم، یک راهش استفاده از سورس‌های Online کتابخانه‌ی مورد نظر است. البته به شرط آن که Library یا برنامه‌ی مورد نظر Open Source بوده و سورس کد آن به صورت Online …

BelongsTo and cascading

BelongsTo is a attribute in Castle ActiveRecord that is used to mark an association as many-to-one. For example consider following class diagram. There is an association between Student and Teacher named ArtStudent. This is a many-to-one association so you must add BelongsTo attribute to Student class as showed in following code snippet. [ActiveRecord(Lazy = true)]public …

Paging methods

ASP.NET GridView and other similar controls that support paging needs special methods that return only the requested slice of data and  the count of total data. As I’m a lover of NHibernate/Castle ActiveRecord I have gathered paging techniques in NHibernate HQL, LINQ-to-NHibernate and Castle ActiveRecord: NHIbernate HQL: public IList GetData(int page, int pageSize, ref long …