Friday, June 22, 2018
Monday, June 4, 2018
Best Software Architecture
Always program your #software into separated layers to be able to add to it easily and smoothly, the most preferred layers for me are:
1- Data Store
2- Business Logic
3- Web API
4- UI (Desktop - Web - Mobile - Arduino)
By this architecture, whatever the #UI you will use, it shall be easily integrated without doing too much work.
One of the most successful combination for doing this architecture is using the following with each layer:
- Data Store: Any database is recommended but if you are looking for a light one you can use SQLLite, for me I prefer using MSSQL.
- Business Logic: If you are fond with Microsoft and C#, you can do it by starting your Windows Class Library project template from Visual Studio.
- Web API: Looking for a fast user friendly Web API, user ASP.NET Core 2 for creating your Web API, again you can find this template in Visual Studio 2017 - Sure you can use any technology for creating your restful api.
- UI: The most interesting part, you can easily integrate any UI type with your project, if you used the above architecture
- Web App : for me I prefer Angular for the web app, fast easy and maintainable, you can use of course whatever technology you like ASP.NET MVC, ASP.NET Web Forms, PHP, or even Java.
- Desktop App: As you guessed, yes I prefer WPF for developing desktop application, but you can use any.
- Mobile App: Mobile, it really rocks to access the world from your mobile, if you are IOs developer, Android Developer or cross platform maniac, the above architecture rocks for the mobile, for me I prefer using Native Mobile Development either for Android or IOs
- IOT: What can I say, I have discovered a new whole world when I started reading about IOT, my dream about the smart home, the smart car and the smart city became true, you can start your IOT project by using any micro controller board, the most famous are Arduino and Raspberry PI, for me I'm in love with Arduino, it is simple, light, friendly and there are lots of Arduino addons in the market, sensors, cameras, networking, etc., whatever you are dreaming you will find easily and cheaply.
Your limits is the sky when you extend the capabilities of your software to control the surrounding hardware.
Labels:
Angular,
Arduino,
asp.net,
asp.net mvc,
asp.net web forms,
c#,
Desktop App,
Mobile App,
MSSQL,
Restful API,
Software,
SQLLite,
UI,
Web API,
Web App,
WPF
Wednesday, November 23, 2016
Entity Frame Work: CRUD in disconnected mode
![]() | |
| EF Architecture |
In this post we will show how to do your CRUD operations in disconnected mode.
Prerequisites:
1- C# programming
2- Basic knowledge of how to start with "Entity Framework" - EF
First we have to know what we mean by "disconnected mode", disconnected mode means that you receive the data model from a different tier than your current db context.
Ex. You got a "Student" object from a "web service" or "web api" and you need to insert or update this student in your database.
Operations:
1- Create / Insert record
a- "DBSet.Add()" add new object "graph" with automatically applying "added" to its state
![]() |
| DbSet.Add() - State Changed |
b- "DBSet.Attach()" add new object "graph" without applying a change to its state
![]() |
| DbSet.Attach() - State Not Changed |
c- "DbSet.Add() / "context.SaveChanges() - Adding just the entity
![]() |
| DbSet.Add()/context.SaveChanges() - Saving just the entity without graph |
or alternatively we can use the "context.Entry() add mark it as added
![]() |
| context.Entry() / context.SaveChanges() - Saving Just the Entity |
2- Update
To modify an entity outside the context scope and then update it into the database, we use the following:
a- Make the modification in our entity
b- Pass the modified entity into the entry method and marks its state as Modified
c- Call SaveChanges() method to update entity information
![]() |
| Update Entity - Disconnected Mode |
3- Delete
Like the previous "Update" example, we will use context.Entry() method to delete an entity in disconnected mode
![]() |
| Delete Entity - Disconnected Mode |
For deeper look into Entity Framework you can visit this link http://www.entityframeworktutorial.net/EntityFramework5/entity-framework5-introduction.aspx
Labels:
c#,
CRUD,
delete,
disconnected mode,
ef,
entity framework,
insert,
update
Sunday, November 6, 2016
C# ASP.NET Web Forms: Create Custom Event in Web User Control and Subscribe to It
Hello guys,
I tried this to add a custom event to a UserControl and Subscribed to it from the main page containing the UserControl, it is very easy little steps, but very helpful, you will find below screen shots, and an attached solution file as a sample
I tried this to add a custom event to a UserControl and Subscribed to it from the main page containing the UserControl, it is very easy little steps, but very helpful, you will find below screen shots, and an attached solution file as a sample
- In the user control before the class declare an event as follows "public event EventHandler eventname;"
- Raise the event in whatever event you want as follows "if(eventname != null) this.eventname(object, e);"
(001. Solution Files)
(002. User Control UI)
User Interface for the UserControl - a simple drop down that when changed it raise the drpChanged event in the user control
(003. User Control Code)
- in the MainPage, drag the user control
- open the main page in the design mode - source, and go to the user control and add the attribute "OnEventName=name_of_the_event_handler"
(004. Main Page UI)
(005. Main Page HTML)
(006. Main Page UI after firing the event)
(005. Main Page HTML)
(006. Main Page UI after firing the event)
You can find the complete c# sample code under Our Slack Channer
https://itggeeks.slack.com/files/tarek/F2T1J69M4/usercontroleventexample.rar
Labels:
asp.net,
c#,
custom events,
user control,
web forms
Subscribe to:
Comments (Atom)














