Posts

Showing posts from 2015

How to use "PetaPoco - A tiny ORM-ish thing for your POCOs"

PetePoco is a tiny, fast, single-file micro-ORM for .NET and Mono.
It is a single file that you easily add to any project.It works wit strongly typed POCO's.It supports a close relationship between object and database table.It is fast because it uses dynamic method generations (MSIL) to assign column values to properties. 

Click here to read moreabout PetaPoco..
And this is how you can use it to insert, update, delete and retrieve the records, it is amazing and easy to use! Add PetePoco package to your project by using Nuget (http://nuget.org/List/Packages/PetaPoco)After installation you will see the PetaPoco class added to your project.It is ready to use and this is how you can use it!

[PetaPoco.TableName("fsCarts")] [PetaPoco.PrimaryKey("RecordID")] publicclassCart {   [Key] publicint RecordId { get; set; } publicstring CartId { get; set; } publicGuid ProductId { get; set; } publicint Count { get; set; } publicDateTime DateCreated { get; set; }
}

Converting Enum Values to Generic List

Working with Enum values is very useful in so many circumstances and when you need to covert these enum values to List<SelectListItem>, here is how you can do it;


public List<SelectListItem> GetPaymentOptions()
{
    PaymentOptions[] values = (PaymentOptions[])Enum.GetValues(typeof(PaymentOptions));

    var list = from value in values
               select new SelectListItem()
               {
                   Value = ((int)value).ToString(),
                   Text = value.ToString()
                };

    List<SelectListItem> paymentOptions = list.ToList<SelectListItem>();

    return paymentOptions;
}
That is all- nice and simple!

Happy coding!

Solution for "DestinationUnreachable" Problem When Using SOAPUI to Test Your Web Service

Image
This error occurs when you try to test one of the web service methods by using SoapUI.

All you need to do is;

Check "Add default wsa:To" from WS-A tab as shown below.












That is all!
Happy coding!

Solution for Umbraco Mvc Project Error: "Could not load file or assembly 'ClientDependency.Core, Version=1.7.1.2, Culture=neutral, PublicKeyToken=null.' or one of its dependencies"

Image
This error occurs  when trying to add a new controller to a Umbraco Mvc project(Umbraco version is 7.1.x.). This is an Umbraco bug and this is because of umbraco assemblies were built with specific versions.

All you need to do is;
Upgrade the umbraco mvc version to 7.2.2 or later by using Nuget Package Manager.If you don't want to upgrade your umbraco mvc version, then you can just copy an existing controller and paste it and change it according to your project needs. This is the other way. That's all!

Error Message:









Happy coding!

Solution for "This configuration section cannot be used at this path. This happens when the section is locked at a parent level..."

This error occurs  when there is a problem reading the configuration file for the Web server or Web application.

All you need to do is;

Click "Start" button.Search for "Turn windows features on or off".In the Windows Features window, go to "Internet Information Services\World Wide Web Services\Application Development Features".Check all the features apart from CGI.Restart your IIS.
That's all!

Error Message:
This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".

Happy coding!