Exemplo n.º 1
0
        protected void InitOuterJoinFetchSetting(HbmManyToMany manyToMany, IFetchable model)
        {
            FetchMode fetchStyle;
            bool      lazy = true;

            if (!manyToMany.fetchSpecified)
            {
                if (!manyToMany.outerjoinSpecified)
                {
                    //NOTE SPECIAL CASE:
                    // default to join and non-lazy for the "second join"
                    // of the many-to-many
                    lazy       = false;
                    fetchStyle = FetchMode.Join;
                }
                else
                {
                    fetchStyle = GetFetchStyle(manyToMany.outerjoin);
                }
            }
            else
            {
                fetchStyle = GetFetchStyle(manyToMany.fetch);
            }

            model.FetchMode = fetchStyle;
            model.IsLazy    = lazy;
        }
Exemplo n.º 2
0
        private string FetchEntityText(IFetchable fetchable)
        {
            var token = fetchable.Token;
            var query = Messages.Where(x => x.SequenceNumber == fetchable.SequenceNumber).Select(x => x.Parts(token)).ToList().FirstOrDefault();
            var text  = (string)query;

            if (string.IsNullOrEmpty(text))
            {
                Debug.WriteLine("Unable to fetch item, server did not give any response. Perhaps it was removed ?");
                return(string.Empty);
            }
            return(text);
        }
		protected void InitOuterJoinFetchSetting(HbmManyToMany manyToMany, IFetchable model)
		{
			FetchMode fetchStyle;
			bool lazy = true;

			if (!manyToMany.fetchSpecified)
			{
				if (!manyToMany.outerjoinSpecified)
				{
					//NOTE SPECIAL CASE:
					// default to join and non-lazy for the "second join"
					// of the many-to-many
					lazy = false;
					fetchStyle = FetchMode.Join;
				}
				else
				{
					fetchStyle = GetFetchStyle(manyToMany.outerjoin);
				}
			}
			else
			{
				fetchStyle = GetFetchStyle(manyToMany.fetch);
			}

			model.FetchMode = fetchStyle;
			model.IsLazy = lazy;
		}
Exemplo n.º 4
0
		private static void InitOuterJoinFetchSetting( XmlNode node, IFetchable model )
		{
			XmlAttribute fetchNode = node.Attributes[ "fetch" ];

			OuterJoinFetchStrategy fetchStyle;

			if( fetchNode == null )
			{
				XmlAttribute jfNode = node.Attributes[ "outer-join" ];
				if( jfNode == null )
				{
					fetchStyle = OuterJoinFetchStrategy.Auto;
				}
				else
				{
					// use old (HB 2.1) defaults if outer-join is specified
					string eoj = jfNode.Value;
					if( "auto".Equals( eoj ) )
					{
						// TODO: H3 has two special cases here, for many-to-many and one-to-one
						fetchStyle = OuterJoinFetchStrategy.Auto;
					}
					else
					{
						bool join = "true".Equals( eoj );
						fetchStyle = join ?
							OuterJoinFetchStrategy.Join :
							OuterJoinFetchStrategy.Select;
					}
				}
			}
			else
			{
				bool join = "join".Equals( fetchNode.Value );
				fetchStyle = join ?
					OuterJoinFetchStrategy.Join :
					OuterJoinFetchStrategy.Select;
			}

			model.OuterJoinFetchSetting = fetchStyle;
		}
Exemplo n.º 5
0
        protected static void InitOuterJoinFetchSetting(XmlNode node, IFetchable model)
        {
            XmlAttribute fetchNode = node.Attributes["fetch"];
            FetchMode fetchStyle;
            bool lazy = true;

            if (fetchNode == null)
            {
                XmlAttribute jfNode = node.Attributes["outer-join"];
                if (jfNode == null)
                    if ("many-to-many".Equals(node.Name))
                    {
                        //NOTE SPECIAL CASE:
                        // default to join and non-lazy for the "second join"
                        // of the many-to-many
                        lazy = false;
                        fetchStyle = FetchMode.Join;
                    }
                    else if ("one-to-one".Equals(node.Name))
                    {
                        //NOTE SPECIAL CASE:
                        // one-to-one constrained=falase cannot be proxied,
                        // so default to join and non-lazy
                        lazy = ((OneToOne) model).IsConstrained;
                        fetchStyle = lazy ? FetchMode.Default : FetchMode.Join;
                    }
                    else
                        fetchStyle = FetchMode.Default;
                else
                {
                    // use old (HB 2.1) defaults if outer-join is specified
                    string eoj = jfNode.Value;
                    if ("auto".Equals(eoj))
                        fetchStyle = FetchMode.Default;
                    else
                    {
                        bool join = "true".Equals(eoj);
                        fetchStyle = join
                            ?
                                FetchMode.Join
                            :
                                FetchMode.Select;
                    }
                }
            }
            else
            {
                bool join = "join".Equals(fetchNode.Value);
                fetchStyle = join
                    ?
                        FetchMode.Join
                    :
                        FetchMode.Select;
            }

            model.FetchMode = fetchStyle;
            model.IsLazy = lazy;
        }
Exemplo n.º 6
0
 protected static void InitLaziness(XmlNode node, IFetchable fetchable, string proxyVal, bool defaultLazy)
 {
     XmlAttribute lazyNode = node.Attributes["lazy"];
     bool isLazyTrue = lazyNode == null
         ?
             defaultLazy && fetchable.IsLazy
         : //fetch="join" overrides default laziness
         lazyNode.Value.Equals(proxyVal); //fetch="join" overrides default laziness
     fetchable.IsLazy = isLazyTrue;
 }
Exemplo n.º 7
0
 private string FetchEntityText(IFetchable fetchable)
 {
     var token = fetchable.Token;
     var query = Messages.Where(x => x.SequenceNumber == fetchable.SequenceNumber).Select(x => x.Parts(token)).ToList().FirstOrDefault();
     var text = (string) query;
     if (string.IsNullOrEmpty(text)) {
         Debug.WriteLine("Unable to fetch item, server did not give any response. Perhaps it was removed ?");
         return string.Empty;
     }
     return text;
 }