T h i s   W e b   A P I   s a m p l e   a p p l i c a t i o n   p r o v i d e s   y o u   t h e   b a s i c   e l e m e n t s   o f   a n   a p p l i c a t i o n   t h a t   u s e s   . N E T   D a t a S t o r e   f o r   d a t a   a c c e s s . 
 
 
 
 P r e r e q u i s i t e : 
 
 B e c a u s e   t h e   . N E T   D a t a S t o r e   m o d e l   ( D _ D e p a r t m e n t . c s )   i n   t h e   a p p l i c a t i o n   i s   a l r e a d y   b o u n d   w i t h 
 
 s p e c i f i c   D a t a C o n t e x t   ( d a t a b a s e   c o n n e c t i o n ) ,   y o u   n e e d   t o   s e t   u p   t h e   d a t a b a s e   f o l l o w i n g   t h e s e   s t e p s : 
 
 1 .   D o w n l o a d   t h e   d a t a b a s e   b a c k u p   f i l e   f r o m   h t t p s : / / g i t h u b . c o m / M i c r o s o f t / s q l - s e r v e r - s a m p l e s / r e l e a s e s / d o w n l o a d / a d v e n t u r e w o r k s / A d v e n t u r e W o r k s 2 0 1 2 . b a k . 
 
 2 .   I n s t a l l   S Q L   S e r v e r   i f   i t   i s   n o t   i n s t a l l e d . 
 
 3 .   R e s t o r e   d a t a b a s e   u s i n g   t h e   d o w n l o a d e d   d a t a b a s e   b a c k u p   f i l e . 
 
 4 .   I n   a p p s e t t i n g s . j s o n ,   m o d i f y   t h e   d a t a b a s e   c o n n e c t i o n   n a m e   f r o m   t h e   d e f a u l t   " L o c a l "   t o   a   n a m e   y o u   p r e f e r   t o   u s e ,   
 
       a n d   m o d i f y   t h e   d a t a s o u r c e ,   i n i t i a l   c a t a l o g ,   u s e r n a m e   a n d   p a s s w o r d   o f   t h e   d a t a b a s e   c o n n e c t i o n   s t r i n g . 
 
 5 .   I n   t h e   C o n f i g u r e S e r v i c e s   m e t h o d   o f   S t a r t u p . c s ,   g o   t o   t h e   f o l l o w i n g   l i n e ,   a n d   r e p l a c e   t h e   C o n n e c t i o n S t r i n g   n a m e   " k e y " 
 
       w i t h   t h e   d a t a b a s e   c o n n e c t i o n   n a m e   s p e c i f i e d   i n   s t e p   # 4 . 
 
 	 s e r v i c e s . A d d D a t a C o n t e x t < S a m p l e D a t a C o n t e x t > ( m   = >   m . U s e S q l S e r v e r ( C o n f i g u r a t i o n [ " C o n n e c t i o n S t r i n g s : k e y " ] ) ) ; 
 
 
 
 H o w   t o   r u n   t h e   s a m p l e   a p p : 
 
 E n t e r   t h e   U R L   h t t p : / / l o c a l h o s t : 5 0 0 0 / a p i / s a m p l e / r e t r i e v e o n e / { i d } . 
 
 
 
 B a s i c   e l e m e n t s   o f   t h e   a p p l i c a t i o n : 
 
 1 . 	 T h e   P r o g r a m . c s   f i l e . 
 
 	 T h i s   f i l e   i s   t h e   e n t r y   p o i n t   f o r   t h e   a p p l i c a t i o n .   I t   s e t s   u p   t h e   I W e b H o s t ,   a n d   c o n t a i n s   
 
 	 t h e   U s e S t a r t u p < S t a r t u p >   l i n e   w h i c h   t e l l s   t h e   h o s t   t o   u s e   t h e   S t a r t u p . c s   f i l e . 
 
 
 
 2 . 	 T h e   S t a r t u p . c s   f i l e . 
 
 	 I n   t h i s   f i l e ,   t h e   C o n f i g u r e S e r v i c e s   m e t h o d   c o n f i g u r e s   t h e   s e r v i c e s   f o r   d e p e n d e n c y   i n j e c t i o n ; 
 
 	 t h e   U s e C o r e I n t e g r a t e d   m e t h o d   a n d   U s e P o w e r B u i l d e r I n t e g r a t e d   m e t h o d   i n 
 
 	 t h e   C o n f i g u r e S e r v i c e s   m e t h o d   e n a b l e s   t h e   a c t i o n s   i n   t h e   c o n t r o l l e r   t o   s u p p o r t   P o w e r B u i l d e r 
 
 	 b a s e d   t e c h n o l o g y   ( e . g .   D a t a W i n d o w ) ;   t h e   C o n f i g u r e   m e t h o d   s p e c i f i e s   h o w   t h e   s e r v i c e 
 
 	 r e s p o n d s   t o   t h e   r e q u e s t s ;   t h e   U s e D a t a W i n d o w   m e t h o d   i n   t h e   C o n f i g u r e   m e t h o d   p a r s e s   a n d 
 
 	 l o a d s   a l l   D a t a W i n d o w   o b j e c t s   o f   t h e   c u r r e n t   a p p l i c a t i o n . 
 
 	 B o t h   t h e   C o n f i g u r e S e r v i c e s   m e t h o d   a n d   C o n f i g u r e   m e t h o d s   a r e   s t a n d a r d   m e t h o d s   i n   C #   d e v e l o p m e n t . 
 
 	 F o r   m o r e   d e s c r i p t i o n ,   y o u   m a y   r e f e r   t o 
 
 	 h t t p s : / / d o c s . m i c r o s o f t . c o m / e n - u s / a s p n e t / c o r e / f u n d a m e n t a l s / s t a r t u p ? v i e w = a s p n e t c o r e - 2 . 1 . 
 
 
 
 3 . 	 T h e   S a m p l e D a t a C o n t e x t . c s   f i l e . 
 
 	 T h e   S a m p l e D a t a C o n t e x t . c s   f i l e   c o n t a i n s   t h e   c l a s s   t h a t   m a n a g e s   d a t a b a s e   c o n n e c t i o n s   a n d   t r a n s a c t i o n s . 
 
 
 
 4 . 	 T h e   a p p s e t t i n g s . j s o n   f i l e . 
 
 	 T h e   d a t a b a s e   c o n n e c t i o n   s t r i n g   a n d   o t h e r   a p p   s e t t i n g s   a r e   s a v e d   i n   a p p s e t t i n g s . j s o n . 
 
 
 
 5 . 	 T h e   D a t a W i n d o w s   f o l d e r . 
 
 	 T h e   D _ D e p a r t m e n t . c s   f i l e   i s   t h e   . N E T   D a t a S t o r e   m o d e l   t h a t   i s   g e n e r a t e d   f r o m   a   P o w e r B u i l d e r 
 
 	 D a t a W i n d o w   u s i n g   t h e   C #   M o d e l   G e n e r a t o r   t o o l   p r o v i d e d   i n   t h e   P o w e r B u i l d e r   I D E ; 
 
 	 T h e   d e p a r t m e n t . p b w c o n f i g   r e c o r d s   f r o m   w h i c h   D a t a W i n d o w   t h e   . N E T   D a t a S t o r e   m o d e l   i s   g e n e r a t e d ; 
 
 	 T h e   d _ d e p a r t m e n t . s r d   i s   t h e   s o u r c e   f i l e   o f   t h e   c o r r e s p o n d i n g   P o w e r B u i l d e r   D a t a W i n d o w . 
 
 
 
 6 . 	 T h e   I S a m p l e S e r v i c e . c s   a n d   S a m p l e S e r v i c e . c s   f i l e s . 
 
 	 T h e   i n t e r f a c e   f i l e   I S a m p l e S e r v i c e . c s   c o n t a i n s   o n l y   t h e   d e c l a r a t i o n   o f   t h e   m e t h o d s   f o r   t h e   s e r v i c e s . 
 
 	 T h e   s e r v i c e   f i l e   S a m p l e S e r v i c e . c s   c o n t a i n s   t h e   i m p l e m e n t a t i o n   o f   t h e   s e r v i c e s   t h a t   t h e   a p p l i c a t i o n p r o v i d e s . 
 
 
 
 7 . 	 T h e   S a m p l e C o n t r o l l e r . c s   f i l e . 
 
 	 I t   c o n t a i n s   t h e   s a m p l e   A P I   c o n t r o l l e r   c l a s s ,   w h i c h   p r o v i d e s   m e t h o d s   t h a t   r e s p o n d   t o   H T T P   r e q u e s t s . 
 
 
 
 8 . 	 T h e   l a u n c h S e t t i n g s . j s o n   f i l e . 
 
 	 I t   i s   a   s t a n d a r d   f i l e   i n   A S P . N E T   C o r e .   T h i s   f i l e   s e t s   u p   t h e   e n v i r o n m e n t s   t h a t   S n a p D e v e l o p   c a n   l a u n c h   a u t o m a t i c a l l y . 
 
 