- Added WingdingsSymbolField. - Improved detection of nested properties. - Added new overload for ProgressBarField template. Now it's possible to select its color based on the current row's values. - Added WingdingsSymbols/WingdingsSymbolsPdfReport.cs sample. - Added new NestedProperties/NestedPropertiesPdfReport.cs sample. - Added another WPF Sample (WpfAppAcroReader). - Enabled full compression. - Improved QRCode (Barcodes/BarcodesPdfReport.cs) sample to use a transparent background. - Improved the ASP.MVC sample to show how to Flush or Browse the produced PDF file. - Improved the DynamicCrosstab/DynamicCrosstabPdfReport.cs sample to show how to change the captions of the header row.
- مطالعه مسیر آموزشی "Entity Framework Code-First"
- مطالعه مسیر آموزشی "Asp.NET MVC"
- مطالعه مقالات مربوط به "Asp.net Identity"
- مطالعه مسیر آموزشی "اصول طراحی شی گرا SOLID" و دوره "بررسی مفاهیم معکوس سازی وابستگیها و ابزارهای مرتبط با آن"
- انجمن
- ارتباط دوستی
- سیستم ترفیع رتبه
- Themeable
- سیستم Following
- صفحات داینامیک
- سیستم پیام رسانی
- امکان ساخت گروههای شخصی برای انتشار مطالب خود (توسط کاربران) با اعمال دسترسی مختلف
- پیغام خصوصی
- وبلاگ
- نظرسنجی ها
- مدیریت کاربران با دسترسیها داینامیک
- اخبار
- آگهی ها
/// <summary> /// Represents the lable /// </summary> public class Tag { #region Ctor /// <summary> /// Create one instance of <see cref="Tag"/> /// </summary> public Tag() { Id = SequentialGuidGenerator.NewSequentialGuid(); } #endregion #region Properties /// <summary> /// sets or gets Tag's identifier /// </summary> public virtual Guid Id { get; set; } /// <summary> /// sets or gets Tag's name /// </summary> public virtual string Name { get; set; } #endregion #region NavigationProperties /// <summary> /// sets or gets Tag's posts /// </summary> public virtual ICollection<BlogPost> BlogPosts { get; set; } #endregion }
/// <summary> /// Represents the Post's Draft /// </summary> public class BlogDraft { #region Ctor /// <summary> /// create one instance of <see cref="BlogDraft"/> /// </summary> public BlogDraft() { Id = SequentialGuidGenerator.NewSequentialGuid(); } #endregion #region Properties /// <summary> /// gets or sets Id of post's draft /// </summary> public virtual Guid Id { get; set; } /// <summary> /// gets or sets body of post's draft /// </summary> public virtual string Body { get; set; } /// <summary> /// gets or set title of post's draft /// </summary> public virtual string Title { get; set; } /// <summary> /// gets or sets tags of post's draft that seperated using ',' /// </summary> public virtual string TagNames { get; set; } /// <summary> /// gets or sets value indicating whether this draft is ready to publish /// </summary> public virtual bool IsReadyForPublish { get; set; } /// <summary> /// ges ro sets DateTime that this draft added /// </summary> public virtual DateTime CreatedOn { get; set; } /// <summary> /// gets or sets information of User-Agent /// </summary> public virtual string Agent { get; set; } /// <summary> /// gets or sets date that this draft publish as ready /// </summary> public virtual DateTime? ReadyForPublishOn { get; set; } #endregion #region NavigationProperties /// <summary> /// gets or sets Id of user that he is owner of this draft /// </summary> public virtual long OwnerId { get; set; } /// <summary> /// gets or sets user that he is owner of this draft /// </summary> public virtual User Owner { get; set; } #endregion }
/// <summary> /// Section of Rating /// </summary> public enum RatingSection { News, Announcement, ForumTopic, BlogComment, NewsComment, PollComment, AnnouncementComment, ForumPost, ... } /// <summary> /// Represents Rating Record regard by section type for Rating System /// </summary> public class UserRating { #region Ctor /// <summary> /// Create one instance of <see cref="UserRating"/> /// </summary> public UserRating() { Id = SequentialGuidGenerator.NewSequentialGuid(); } #endregion #region Properties /// <summary> /// gets or sets Id of Rating Record /// </summary> public virtual Guid Id { get; set; } /// <summary> /// gets or sets value of rate /// </summary> public virtual double RatingValue { get; set; } /// <summary> /// gets or sets Section's Id /// </summary> public virtual long SectionId { get; set; } /// <summary> /// gets or sets Section /// </summary> public virtual RatingSection Section { get; set; } #endregion #region Navigation Properties /// <summary> /// gets or sets user that rate one section /// </summary> public virtual User Rater { get; set; } /// <summary> /// gets or sets Rater Id that rate one section /// </summary> public virtual long RaterId { get; set; } #endregion }
/// <summary> /// Represent the rating as ComplexType /// </summary> [ComplexType] public class Rating { /// <summary> /// sets or gets total of rating /// </summary> public virtual double? TotalRating { get; set; } /// <summary> /// sets or gets rater's count /// </summary> public virtual long? RatersCount { get; set; } /// <summary> /// sets or gets average of rating /// </summary> public virtual double? AverageRating { get; set; } }
/// <summary> /// Represents a base class for every content in system /// </summary> public abstract class BaseContent { #region Properties /// <summary> /// get or set identifier of record /// </summary> public virtual long Id { get; set; } /// <summary> /// gets or sets date of publishing content /// </summary> public virtual DateTime PublishedOn { get; set; } /// <summary> /// gets or sets Last Update's Date /// </summary> public virtual DateTime ModifiedOn { get; set; } /// <summary> /// gets or sets the blog pot body /// </summary> public virtual string Body { get; set; } /// <summary> /// gets or sets the content title /// </summary> public virtual string Title { get; set; } /// <summary> /// gets or sets value indicating Custom Slug /// </summary> public virtual string SlugUrl { get; set; } /// <summary> /// gets or sets meta title for seo /// </summary> public virtual string MetaTitle { get; set; } /// <summary> /// gets or sets meta keywords for seo /// </summary> public virtual string MetaKeywords { get; set; } /// <summary> /// gets or sets meta description of the content /// </summary> public virtual string MetaDescription { get; set; } /// <summary> /// gets or sets /// </summary> public virtual string FocusKeyword { get; set; } /// <summary> /// gets or sets value indicating whether the content use CanonicalUrl /// </summary> public virtual bool UseCanonicalUrl { get; set; } /// <summary> /// gets or sets CanonicalUrl That the Post Point to it /// </summary> public virtual string CanonicalUrl { get; set; } /// <summary> /// gets or sets value indicating whether the content user no Follow for Seo /// </summary> public virtual bool UseNoFollow { get; set; } /// <summary> /// gets or sets value indicating whether the content user no Index for Seo /// </summary> public virtual bool UseNoIndex { get; set; } /// <summary> /// gets or sets value indicating whether the content in sitemap /// </summary> public virtual bool IsInSitemap { get; set; } /// <summary> /// gets or sets a value indicating whether the content comments are allowed /// </summary> public virtual bool AllowComments { get; set; } /// <summary> /// gets or sets a value indicating whether the content comments are allowed for anonymouses /// </summary> public virtual bool AllowCommentForAnonymous { get; set; } /// <summary> /// gets or sets viewed count by rss /// </summary> public virtual long ViewCountByRss { get; set; } /// <summary> /// gets or sets viewed count /// </summary> public virtual long ViewCount { get; set; } /// <summary> /// Gets or sets the total number of comments /// <remarks>The same as if we run Item.Comments.where(a=>a.Status==Status.Approved).Count() /// We use this property for performance optimization (no SQL command executed) /// </remarks> /// </summary> public virtual int ApprovedCommentsCount { get; set; } /// <summary> /// Gets or sets the total number of comments /// <remarks>The same as if we run Item.Comments.where(a=>a.Status==Status.UnApproved).Count() /// We use this property for performance optimization (no SQL command executed)</remarks></summary> public virtual int UnApprovedCommentsCount { get; set; } /// <summary> /// gets or sets value indicating whether the content is logical deleted or hidden /// </summary> public virtual bool IsDeleted { get; set; } /// <summary> /// gets or sets rating complex instance /// </summary> public virtual Rating Rating { get; set; } /// <summary> /// gets or sets value indicating whether the content show with rssFeed /// </summary> public virtual bool ShowWithRss { get; set; } /// <summary> /// gets or sets value indicating maximum days count that users can send comment /// </summary> public virtual int DaysCountForSupportComment { get; set; } /// <summary> /// gets or sets information of User-Agent /// </summary> public virtual string Agent { get; set; } /// <summary> /// gets or sets icon name with size 200*200 px for snippet /// </summary> public virtual string SocialSnippetIconName { get; set; } /// <summary> /// gets or sets title for snippet /// </summary> public virtual string SocialSnippetTitle { get; set; } /// <summary> /// gets or sets description for snippet /// </summary> public virtual string SocialSnippetDescription { get; set; } /// <summary> /// gets or sets body of content's comment /// </summary> public virtual byte[] RowVersion { get; set; } /// <summary> /// gets or sets name of tags seperated by comma that assosiated with this content fo increase performance /// </summary> public virtual string TagNames { get; set; } /// <summary> /// gets or sets counter for Content's report /// </summary> public virtual int ReportsCount { get; set; } #endregion #region NavigationProperties /// <summary> /// get or set user that create this record /// </summary> public virtual User Author { get; set; } /// <summary> /// gets or sets Id of user that create this record /// </summary> public virtual long AuthorId { get; set; } /// <summary> /// get or set the tags integrated with content /// </summary> public virtual ICollection<Tag> Tags { get; set; } #endregion }
بخشهای مختلفی که در ابتدای مقاله مطرح شدند، دارای یکسری خصوصیات مشترک میباشند و برای این منظور این خصوصیات را در یک کلاس پایه کپسوله کردهایم. شاید تفکر شما این باشد که میخواهیم ارث بری TPH یا TPT را اعمال کنیم. ولی با توجه به سلیقهی شخصی، در این بخش قصد استفاده از ارث بری را ندارم.
نکتهای که وجود دارد فیلدهای ApprovedCommentsCount UnApprovedCommentsCount و TagNames میباشند که هنگام درج نظر جدید باید تعداد نظرات ذخیره شده را ویرایش کنیم و هنگام ویرایش خود پست یا خبر با ... و یا حتی ویرایش خود تگ یا حذف آن تگ باید TagNames که لیست برچسبهای محتوا را به صورت جدا شده با (,) از هم دیگر میباشد، ویرایش کنیم (جای بحث دارد).
مشخص است که هر یک از مطالب منتشر شده در بخشهای وبلاگ، اخبار، نظرسنجی و آگهیها، یک کابر ایجاد کننده (Author نامیدهایم) خواهد داشت و هر کاربر هم میتواند چندین مطلب را ایجاد کند. لذا رابطهی یک به چند بین تمام این بخشها مذکور و کاربر ایجاد خواهد شد.
مدل LinkBack
/// <summary> /// Represents link for implemention linkback /// </summary> public class LinkBack { #region Ctor /// <summary> /// create one instance of <see cref="LinkBack"/> /// </summary> public LinkBack() { CreatedOn = DateTime.Now; Id = SequentialGuidGenerator.NewSequentialGuid(); } #endregion #region Properties /// <summary> /// gets or sets link's Id /// </summary> public virtual Guid Id { get; set; } /// <summary> /// gets or sets text for show Link /// </summary> public virtual string Title { get; set; } /// <summary> /// gets or sets link's address /// </summary> public virtual string Url { get; set; } /// <summary> /// gets or set value indicating whether this link is internal o external /// </summary> public virtual LinkBackType Type { get; set; } /// <summary> /// gets or sets date that this record is added /// </summary> public virtual DateTime CreatedOn { get; set; } #endregion #region NavigationProperties /// <summary> /// gets or sets Post that associated /// </summary> public virtual BlogPost Post { get; set; } /// <summary> /// gets or sets id of Post that associated /// </summary> public virtual long PostId { get; set; } #endregion } /// <summary> /// represents Type of ReferrerLinks /// </summary> public enum LinkBackType { /// <summary> /// Internal link /// </summary> Internal, /// <summary> /// External Link /// </summary> External }
مطمئنا در خیلی از وبلاگها مثل سایت جاری متوجه نمایش لینکها ارجاع دهندههای خارجی و داخلی در زیر مطلب شدهاید. کلاس LinkBack هم دقیقا برای این منظور در نظرگرفته شده است که عنوان صفحهای که این پست در آنجا لینک داده شده است، به همراه آدرس آن صفحه، در جدول حاصل از این کلاس ذخیره خواهند شد. نوع داده LinkBackType هم برای متمایز کردن رکوردهای درج شده به عنوان LinkBack در نظر گرفته شده است که بتوان آنها را متمایز کرد، به ارجاعات داخلی و خارجی.
مدل پست ها
/// <summary> /// Represents a blog post /// </summary> public class BlogPost : BaseContent { #region Ctor /// <summary> /// Create one Instance of <see cref="BlogPost"/> /// </summary> public BlogPost() { Rating = new Rating(); PublishedOn = DateTime.Now; } #endregion #region Properties /// <summary> /// gets or sets Status of LinkBack Notifications /// </summary> public virtual LinkBackStatus LinkBackStatus { get; set; } #endregion #region NavigationProperties /// <summary> /// get or set blog post's Reviews /// </summary> public virtual ICollection<BlogComment> Comments { get; set; } /// <summary> /// get or set collection of links that reference to this blog post /// </summary> public virtual ICollection<LinkBack> LinkBacks { get; set; } /// <summary> /// get or set Collection of Users that Contribute on this post /// </summary> public virtual ICollection<User> Contributors { get; set; } #endregion } /// <summary> /// Represents Status for ReferrerLinks /// </summary> public enum LinkBackStatus { [Display(Name ="غیرفعال")] Disable, [Display(Name = "فعال")] Enable, [Display(Name = "لینکها داخلی")] JustInternal, [Display(Name = "لینکها خارجی")] JustExternal }
/// <summary> /// Represents a base class for every comment in system /// </summary> public abstract class BaseComment { #region Properties /// <summary> /// get or set identifier of record /// </summary> public virtual long Id { get; set; } /// <summary> /// gets or sets date of creation /// </summary> public virtual DateTime CreatedOn { get; set; } /// <summary> /// gets or sets displayName of this comment's Creator if he/she is Anonymous /// </summary> public virtual string CreatorDisplayName { get; set; } /// <summary> /// gets or sets body of blog post's comment /// </summary> public virtual string Body { get; set; } /// <summary> /// gets or sets body of blog post's comment /// </summary> public virtual Rating Rating { get; set; } /// <summary> /// gets or sets informations of agent /// </summary> public virtual string UserAgent { get; set; } /// <summary> /// gets or sets siteUrl of Creator if he/she is Anonymous /// </summary> public virtual string SiteUrl { get; set; } /// <summary> /// gets or sets Email of Creator if he/she is anonymous /// </summary> public virtual string Email { get; set; } /// <summary> /// gets or sets status of comment /// </summary> public virtual CommentStatus Status { get; set; } /// <summary> /// gets or sets Ip Address of Creator /// </summary> public virtual string CreatorIp { get; set; } /// <summary> /// gets or sets datetime that is modified /// </summary> public virtual DateTime? ModifiedOn { get; set; } /// <summary> /// gets or sets counter for report this comment /// </summary> public virtual int ReportsCount { get; set; } #endregion #region NavigationProperties /// <summary> /// get or set user that create this record /// </summary> public virtual User Creator { get; set; } /// <summary> /// get or set Id of user that create this record /// </summary> public virtual long? CreatorId { get; set; } #endregion } public enum CommentStatus { /* 0 - approved, 1 - pending, 2 - spam, -1 - trash */ [Display(Name = "تأیید شده")] Approved = 0, [Display(Name = "در انتظار بررسی")] Pending = 1, [Display(Name = "جفنگ")] Spam = 2, [Display(Name = "زباله دان")] Trash = -1 }
/// <summary> /// Represents a blog post's comment /// </summary> public class BlogComment : BaseComment { #region Ctor /// <summary> /// Create One Instance for <see cref="BlogComment"/> /// </summary> public BlogComment() { Rating = new Rating(); CreatedOn = DateTime.Now; } #endregion #region NavigationProperties /// <summary> /// gets or sets BlogComment's identifier for Replying and impelemention self referencing /// </summary> public virtual long? ReplyId { get; set; } /// <summary> /// gets or sets blog's comment for Replying and impelemention self referencing /// </summary> public virtual BlogComment Reply { get; set; } /// <summary> /// get or set collection of blog's comment for Replying and impelemention self referencing /// </summary> public virtual ICollection<BlogComment> Children { get; set; } /// <summary> /// gets or sets post that this comment sent to it /// </summary> public virtual BlogPost Post { get; set; } /// <summary> /// gets or sets post'Id that this comment sent to it /// </summary> public virtual long PostId { get; set; } #endregion }
فایل ARCHITECTURE.md
If you maintain an open-source project in the range of 10k-200k lines of code, I strongly encourage you to add an ARCHITECTURE document next to README and CONTRIBUTING. Before going into the details of why and how, I want to emphasize that this is not another “docs are good, write more docs” advice. I am pretty sloppy about documentation, and, eg, I often use just “simplify” as a commit message. Nonetheless, I feel strongly about the issue, even to the point of pestering you:-)
POST http://localhost:5000/api/account/login 500 (Internal Server Error) Failed to load http://localhost:5000/api/account/login: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access. The response had HTTP status code 500.
تا اینجای کار ساخت کامپوننتها را با React.createClass که تفاوتی با توسعه (ارث بری) از کلاس React.Component ندارد، انجام دادهایم. اما ساخت کامپوننتها به صورت یک تابع هم مزیتهایی را دارد. اول از همه باید بدانیم که ساخت کامپوننت توسط تابع، بدون وضعیت خواهد بود که به آن Stateless میگویند. به دلیل نداشتن وضعیت، کامپوننتهای تابعی را کمی بهتر میشود برای استفاده مجدد به کار برد. در کامپوننتهای غیر تابعی که Stateful هستند به دلیل احتمال وابستگی وضعیت کامپوننت به خارج از کلاس، مانند مثال قسمت چهارم که کامپوننت در انتظار کلیک یک دکمه خاص توسط کاربر بود، مدیریت استفاده مجدد ازکامپوننت چالش برانگیز خواهد شد.
اعتبارسنجی دادههای ورودی
برای مدیریت بهتر کامپوننتها جهت استفاده مجدد از آنها بهتر است ورودیهای کامپوننت را اعتبارسنجی کنیم. این ورودیها چه برای استفاده داخلی کامپوننت، یا جهت مشخص کردن وضعیت آن، بر رفتار کامپوننت تاثیر زیادی دارند. React مجموعهای از اعتبار سنجیها را دارد که میشود به کامپوننت اضافه کرد. باید توجه داشته باشیم که پیامهای خطای این اعتبارسنجیها فقط در حالت Development Mode قابل استفاده هستند. به زبان ساده اگر از react.min.js استفاده کنید، پیامهای خطا را نخواهید دید. باید فایلها را به نوع react.js تبدیل کنید. اعتبارسنجی React در زمان توسعه و برای توسعه دهندگان استفاده میشود.
مثال نوشیدنیها در قسمت چهارم میتوانست نام نوشیدنی و قیمت آن را نمایش دهد و همچنین میتوانستیم به لیست نوشیدنیها، موردی را اضافه کنیم. اگر ورودی قیمت، اعتبارسنجی نشود، میتوان رشتهای را بجای عدد به عنوان قیمت به کامپوننت ارسال کرد. نحوه اعتبارسنجی قیمت نوشیدنیها به صورت زیر است.
const MenuItem = props => ( <li className="list-group-item"> <span className="badge">{props.price}</span> <p>{props.item}</p> </li> ) MenuItem.propTypes = { price: React.PropTypes.number };
شیء propTypes را به کامپوننت اضافه کردهایم و در تنظیمات آن میتوانیم برای هر پارامتر ورودی یکی از اعضای PropTypes از React را که مناسب حال پارامتر است، انتخاب کنیم. در مثال بالا مشخص کردهایم که ورودی price باید عدد باشد و اگر مثلا رشتهای را بجای عدد ارسال کنیم، پیام خطای زیر را در Console خواهیم داشت.
Warning: Failed prop type: Invalid prop `price` of type `string` supplied to `MenuItem`, expected `number`. in MenuItem (created by Menu) in Menu
یا میتوانستیم از React.PropTypes.number.isRequired استفاده کنیم تا درج مقداری برای این ورودی الزامی باشد. اگر اعتبارسنجیهای React کافی نبودند میتوانیم اعتبارسنجیهای سفارشی خودمان را ایجاد کنیم. در مثال زیر میخواهیم ورودی price بیشتر از 15000 نباشد.
MenuItem.propTypes = { price: (props, price)=>{ if(props[price] > 15000){ return new Error("Too expensive!"); } } };
let MenuItem = React.createClass({ propTypes: { price: React.PropTypes.number } }); class MenuItem extends React.Component{ static propTypes = { price: React.PropTypes.number }; }
نوعهای دیگر برای اعتبارسنجی شامل موارد زیر هستند و البته مرجع تمام اعتبارسنجیهای React را میتوانید در اینجا بررسی کنید.
- React.PropTypes.array
- React.PropTypes.bool
- React.PropTypes.number
- React.PropTypes.object
- React.PropTypes.string
مقدار پیشفرض دادههای ورودی
یکی از امکانات مفید دیگر برای مدیریت مقدارهای ورودی، مشخص کردن مقدار پیشفرضی برای یک پارامتر است. برای مثال اگر برای قیمت یک نوشیدنی مقداری وارد نشد، یک حداقل قیمت برای آن در نظر بگیریم، هر چند که ایده و روشی اشتباه است!
MenuItem.defaultProps = { price: 1000 };
همانطور که میبینید روش کار مشابه با اعتبارسنجی است و برای مشخص کردن مقدار پیشفرض برای React.creatClass از متد getDefaultProps که عضوی از React است، استفاده میکنیم.
let MenuItem = React.createClass({ getDefaultProps() { return { price: 200 } }, render() { return ( <li className="list-group-item"> <span className="badge">{this.props.price}</span> <p>{this.props.item}</p> </li> ); } });
ERROR in ./node_modules/angular2-permission/index.ts Module build failed: Error: C:\Front\node_modules\angular2-permission\index.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property. The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format (https://goo.gl/jB3GVv). at AngularCompilerPlugin.getCompiledFile (C:\Front\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:674:23) at plugin.done.then (C:\Front\node_modules\@ngtools\webpack\src\loader.js:467:39) at process._tickCallback (internal/process/next_tick.js:68:7)
ReSharper 2022.1 منتشر شد
- We have two new refactorings for global usings, Extract Global Using and Inline Global Using, with Find Usages support for this feature.
- For
nullable reference types, we’ve split the “should never be null”
warning into two categories: one for those who look at NRT annotation
and one for those who have a runtime check for null. We’ve also added a
setting to enable runtime enforced not null warnings only, and supported
[MemberNotNull]
and[MemberNotNullWhen]
annotations. - We’ve implemented generic attributes support for C#11.