ÀûÓÃC#µÄ¶¯Ì¬ÀàÐÍÀ´ÊµÏÖÓërailsÀàËƵÄÔª±à³Ì(1)
ÊìϤruby on railsµÄ¿ª·¢Ô±¶¼ÖªµÀ£¬ÔÚrubyÖУ¬ÓÐÒ»¸öºÜÖØÒªµÄÌØÐÔ£¬¾ÍÊÇÄܹ»ÊµÏÖÔª±à³Ì£¬ÌرðÊÇÔÚÓÃÓÚ¿ª·¢WebÓ¦ÓõÄrails¿ò¼ÜÖУ¬ÓõÄÌرð¶à¡£ÔÚrailsÖУ¬Òª´´½¨Ò»¸ö¶¯Ì¬·½·¨²¢ÓëÊý¾Ý¿â±í×Ö¶ÎÏà¹ØÁª£¬Ö÷ÒªµÄµÄ²½Öè´ó¸ÅÓÐÕâЩ£º
1¡¢Ê×ÏÈÅäÖúÃÊý¾Ý¿âµÄÁ¬½Ó¡£
2¡¢´´½¨Ò»¸öActiveRecordÄ£ÐÍ£¬Õâ¸öÄ£ÐÍÓëÊý¾Ý¿âµÄ±íÃû³ÆÓÐÒ»¶¨µÄ¹Øϵ(¾ßÌåµÄ¿ÉÒԲο¼Ïà¹ØrailsÎĵµ)
3¡¢´´½¨µÄÒ»¸öActiveRecordÊǼ̳ÐÓÚBaseÀàµÄ£¬ÆäÖÐBaseÀàÖзâ×°ÁË»ù±¾µÄCRUD²Ù×÷
3¡¢È»ºóÔÚ³ÌÐòÔËÐÐʱ£¬¶¯Ì¬¹ØÁªµ½±íµÄ×ֶΣ¬»òÕßÖ´ÐÐÊý¾Ý¿ÉµÄCRUD²Ù×÷¡£
±ÈÈçÓÐÒ»¸ö×÷Õß±íauthor,°üº¬ÓÐ×Ö¶Îid,first_name,last_name¡£È»ºóÓÃrails¹¤¾ßÉú³ÉÒ»¸öÓëÖ®¹ØÁªµÄModuleÀàAuthor£¬ËüÊÇÒ»¸ö¿ÕÀࣺ
class Author < ActiveRecord::Base
end
È»¶ø£¬ÔÚʵ¼Ê²Ù×÷ÖÐ,ÎÒÃÇÈ´¿ÉÒÔÕâÑù²Ù×÷Ëü£º
@author = Author.find(id)
@name = @author.first_name
@author.destory
ÕâЩÔÚ¾²Ì¬ÓïÑÔC#ÖÐÊDz»¿ÉÄÜ×öµÃµ½µÄ¡£ÔÚC#µÄ¶¯Ì¬·½·¨Ã»ÓгöÏÖ֮ǰ£¬Í¨³£ÎªÁËʵÏÖʵÌåÓëÊý¾Ý¿âµÄ±íÓ³É䣬¶¼ÊÇÏÈ´´½¨Ò»¸ö¹Ì¶¨µÄʵÌåÀ࣬ʵÌåÀàµÄÊôÐÔͨ¹ýAttributeÓ³Éäµ½±íµÄ×ֶΣ¬Ò»°ã¶¼ÊÇÏñÏÂÃæµÄ´úÂëËùʾ£º
[TableMap("overtimeinfo","id")]
public class OverTimeEntity
{
[ColumnMap("id",DbType.Int32)]
public int GUID{get;set;}
[ColumnMap("applyUser",DbType.String,"")]
public string UserName{get;set;}
[ColumnMap("applyuserid",DbType.Int32)]
public int UserId{get;set;}
[ColumnMap("FormNo",DbType.String,"")]
public string FormNo{get;set;}
}
ÒÔÉϵÄC#´úÂëÄÜÕâÑùд»¹µÃ¿¿C# 3.0ÌṩÁËÊôÐÔµÄ×Ô¶¯ÊµÏÖ£¬ÔÚÕâ֮ǰ£¬¶¼ÊÇÐèÒªÒªÓÐÏàÓ¦µÄ˽ÓÐ×ֶεģ¬ËùÒÔÄÇʱµÄ°ì·¨ÊÇÊÂÏȶ¨ÒåºÃÒ»¸öÓë±í½
Ïà¹ØÎĵµ£º
1.¾²Ì¬³ÉÔ±ºÍ·Ç¾²Ì¬³ÉÔ±µÄÇø±ð£¿
2.const ºÍ static readonly Çø±ð£¿
3.extern ÊÇʲôÒâ˼£¿
4.abstract ÊÇʲôÒâ˼£¿
5.internal ÐÞÊηûÆðʲô×÷Óã¿
6.sealed ÐÞÊηûÊǸÉʲôµÄ£¿
7.override ºÍ overload µÄÇø±ð£¿
8.ʲôÊÇË÷ÒýָʾÆ÷£¿
9.new ÐÞÊηûÊÇÆðʲô×÷Óã¿
10.this ¹Ø¼ü×ֵĺ¬Ò壿
11.¿ÉÒÔʹÓóéÏóº¯Ê ......
ö¾Ù
¡¡¡¡Ã¶¾ÙÀàÐÍÉùÃ÷Ϊһ×éÏà¹ØµÄ·ûºÅ³£Êý¶¨ÒåÁËÒ»¸öÀàÐÍÃû³Æ¡£Ã¶¾ÙÓÃÓÚ“¶àÏîÑ¡Ôñ”³¡ºÏ£¬¾ÍÊdzÌÐòÔËÐÐʱ´Ó±àÒëʱÒѾÉ趨µÄ¹Ì¶¨ÊýÄ¿µÄ“Ñ¡Ôñ”ÖÐ×ö³ö¾ö¶¨¡£
¡¡¡¡Ã¶¾ÙÀàÐÍ£¨Ò²³ÆΪö¾Ù£©Îª¶¨ÒåÒ»×é¿ÉÒÔ¸³¸ø±äÁ¿µÄÃüÃûÕûÊý³£Á¿ÌṩÁËÒ»ÖÖÓÐЧµÄ·½·¨¡£ÀýÈ磬¼ÙÉèÄú±ØÐ붨ÒåÒ»¸ö±äÁ¿£¬¸Ã±äÁ¿ ......
´ó¼ÒÔÚʵ¼Ê¹¤×÷ѧϰC#µÄʱºò£¬¿ÉÄÜ»áÎÊ£ºÎªÊ²Ã´ÎÒÃÇҪΪһЩÒѾ´æÔڵŦÄÜ£¨±ÈÈçWindowsÖеÄһЩ¹¦ÄÜ£¬C++ÖÐÒѾ±àдºÃµÄһЩ·½·¨£©ÒªÖØбàд´úÂ룬C#ÓÐûÓз½·¨¿ÉÒÔÖ±½Ó¶¼ÓÃÕâЩԱ¾ÒѾ´æÔڵŦÄÜÄØ£¿´ð°¸Êǿ϶¨µÄ£¬´ó¼Ò¿ÉÒÔͨ¹ýC#ÖеÄDllImportÖ±½Óµ÷ÓÃÕâЩ¹¦ÄÜ¡£
DllImportËùÔÚµÄÃû×Ö¿Õ¼ä using System.Runtime.Inte ......
C#»Ï߿ؼþµÄÓ¦ÓÃʵÀý½éÉÜ֮ǰÎÒÃÇÒªÃ÷°×ÔÚC#ÖÐûÓлÏߵĿؼþ£¬ÕâÀïдÁËÒ»¸ö£¬´ó¼Ò·ÖÏí¡£¹²ÓÐÁ½¸ö¿Ø¼þ·Ö±ðÊÇ»ºáÏߺͻÊúÏߵģ¬¹ØÓÚÔõô»Ð±ÏßÓÐÐËȤµÄ¿ÉÒÔ×öÒ»¸ö´ó¼Ò·ÖÏí¡£
C#»Ï߿ؼþÖ®ºáÏß
using System;
using System.Collections;
using System.ComponentModel; ......
Ò»¡¢C#Ô¤´¦ÀíÆ÷Ö¸ÁîÈëÃÅ #define NET11 //NET11,NET20,(±ØÐë·ÅÔÚÎļþµÚÒ»ÐÐ)
using System;
//¡ ¡
//¡ ¡
//¡ ¡
string sBeepType = s.Replace(sKey,"");
#if NET20
int.TryParse(sBeepType,out beepType); //ÔÚ.net 2.0ÖвÅÓеķ½·¨
#endif
#if ......