Practical Web Applications for Daily Living…
Linq to Sql
Any magento developer gathering in Singapore?
Aug 12th
I don’t know if there are any hardcore magento developers based in singapore but hope to find some and have cool collaboration of what we are capable of doing when it comes to magento.
I really love how magento architected these whole thing, not just in they GUI of the admin panel, but also of the ease of coding, you can call any type of data from the database without using any SQL statement. The only problem is the lack of proper documentation of codes or maybe I just didn’t find the right documentation.
I still can’t imagine myself coding all this stuff if i work from scratch.
I missed coding in Visual Studio.
Mar 13th
For two months now, I’ve been digging my way into the open source arena, php and mysql to be specific. I’ve been a full time asp.net csharp developer for more than two years already but now I am into magento and code igniter using LAMP servers. Even though coding in asp.net is a lot easier compare to developing in php (because of visual stdudio.) I still find being in open source now a days is a lot more practical if you and your clients are in the SME business front. For example, magento. I can’t create a system as powerful as magento for a short period of time even if I use asp.net. Yes there are also e-commerce platforms that uses asp.net like aspdotnetstorefront but it is very expensive and is too hard to customize. I used it to one of my clients before, And it was a pain to my ass tweaking its engine to meet the clients needs. Compared to magento, even a php beginner can customize it. I am not saying that I am leaving asp.net now, I can somehow use my experience of both sides to be more effective in my future projects.
Displaying Data from Database using LINQ to SQL and C# in Asp.net MVC
Nov 19th
In Asp.net MVC pattern, it is a good practice to Separate Domain Models (Model) in a separate project within the Project Solution,
And create namespaces Abstract, Concrete and Entities within that DomainModel Project.
Abstract is for the Interface class container, Concrete is for the Data Repository and Entities namespace is for the Model itself,
Wel need to add the assembly of System.data.linq to the DomainModel Project to use the Linq to Sql feature of the .net framework.
Now lets start coding,
I are going to pull a collection of name of people in the database
begin by creating a Model Class, call it Person here is the code:
{
[Table(Name = "mymvc_TABLE")]
public class Person
{
[Column]public int mymvc_ID { get; set; }
[Column]public string mymvc_NAME { get; set; }
}
}
Create the model that will connect with the Database:
{
private Table<Person> personTable;
public SqlProductsRepository(string connectionString)
{
personTable = (new DataContext(connectionString)).GetTable<Person>();
}
public IQueryable<Person> Persons
{
get { return personTable; }
}
}
Create a controller call it “Home” in the MVC web project,
{
public class HomeController : Controller
{
public ViewResult Index()
{
string connString = @"Server=juliusbacosa_server;Database=mymvc;Trusted_Connection=yes;";
SqlProductsRepository personRepository = new SqlProductsRepository(connString);
return View(personRepository.Persons.ToList());
}
}
}
now right-click the Index ViewResult Method and add a View…
here is how to display the data in the View
<h2>FROM DATABASE REPOSITORY MVC</h2>
<ul>
<% foreach (var i in Model)
{ %>
<li> <%= i.mymvc_NAME %> </li>
<%} %>
</ul>
</asp:Content>
